Introduction to MySQL temporary tables

Source: Internet
Author: User

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;

 
 
  1. CREATE TEMPORARY TABLE tmp (   
  2. article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,   
  3. price DOUBLE(16,2) DEFAULT '0.00' NOT NULL);  
  4. LOCK TABLES article read;  
  5. INSERT INTO tmp SELECT article, MAX(price) FROM shop GROUP BY article;  
  6. SELECT article, dealer, price FROM shop, tmpWHERE shop.article=tmp.articel AND shop.price=tmp.price;  
  7. UNLOCK TABLES;  
  8. 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.