Usage of Mysql temporary Table
Mysql temporary table concept * occasionally need to run many queries to get a subset of a large amount of data * temporary tables exist when connecting to the database Disconnect, automatically delete the table and free up space * two different connections can use the same temporary table name, and the two will not conflict with each other * when creating, use the keyword IF NOT EXISTS to prevent errors in creating temporary tables create temporary table if not exists tmp_table (name VARCHAR (10) NOT NULL,value INTEGER NOT NULL,userName varchar (500), phone varchar (500)) Import query results into temporary tables select user_id, phone select username, depositionfrom user, compaywhere user.id = compay.idorder by user.cityINTO TEMP user_compay query temporary tables select * from user_company create and import results into temporary tables CREATE TEMPORARY TABLE tmp_table AS (SELECT * FROM table_name where xxx)