The following articles mainly describe the MySQL temporary table function. The original Article is as follows. I thought that MySQL databases do not have similar functions of sqlserver, however, a small batch of temporary creation and use methods were found in the MySQL reference manual;
- CREATE TEMPORARY TABLE tmp (
- article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
- price DOUBLE(16,2) DEFAULT '0.00' NOT NULL);
- LOCK TABLES article read;
- INSERT INTO tmp SELECT article, MAX(price) FROM shop GROUP BY article;
- SELECT article, dealer, price FROM shop, tmpWHERE shop.article=tmp.articel AND shop.price=tmp.price;
- UNLOCK TABLES;
- DROP TABLE tmp;
I don't even have a specific explanation except for a few words. I have no idea,
But fortunately, it is easy to understand and use, but with it, operations in many places will be much more convenient, but I do not know the consumption of Database Server resources, the above content is an introduction to the MySQL temporary table function. I hope you will find some gains.
The above content is an introduction to the MySQL temporary table function. I hope you will find some gains.