Get the App
SLTechnology News&Howtos  ›  Servers  › 

Usage of Mysql temporary Table

Shulou Source: shulou.com Published: 2022-06-03 09:50:36 09月21日 Update

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)

Tags: Query data result different same two key keyword name subset database time concept space error and will conflict run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno NVidia Docker MariaDB Microsoft