DROP TEMPORARY TABLE IF EXISTS temp_tb;
CREATE TEMPORARY TABLE tmp_table ( NAME VARCHAR (10) NOT NULL, time date NOT NULL ); select * from tmp_table;
SELECT a.,b. FROM luntan LEFT JOIN usertable as b ON a.username=b.username
SELECT a.,b. FROM city as a FULL OUTER JOIN user as b ON a.username=b.username
SELECT type,pub_name FROM titles CROSS JOIN publishers ORDER BY type
ALTER TABLE people ADD INDEX lname_fname_age (lame,fname,age);
SELECT trx_MySQL_thread_id FROM information_schema.INNODB_TRX;
SELECT data AS old_data, version AS old_version FROM …; //根据获取的数据进行业务操作,得到new_data和new_version UPDATE SET data = new_data, version = new_version WHERE version = old_version if (updated row > 0) { // 乐观锁获取成功,操作完成 } else { // 乐观锁获取失败,回滚并重试 }