Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A simple way for MySQL to use temporary tables

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly tells you about the simple method of using temporary tables in MySQL. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on the simple method of using temporary tables in MySQL can bring you some practical help.

Temporary tables have an effect only when connecting to the database. Once resources are released, they are deleted. When the connection is closed, Mysql automatically deletes the table and frees up all space. Use a simple instance of the MySQL temporary table to create commands CREATE TEMPORARY CREATE TEMPORARY TABLE SalesSummary (- > product_name VARCHAR (50) NOT NULL- >, total_sales DECIMAL (12Magne2) NOT NULL DEFAULT 0.00- >, avg_unit_price DECIMAL (7mem2) NOT NULL DEFAULT 0.00- >, total_units_sold INT UNSIGNED NOT NULL DEFAULT 0) Insert statement INSERT INTO SalesSummary- > (product_name, total_sales, avg_unit_price, total_units_sold)-> VALUES- > ('cucumber', 100.25, 90, 2)

Note that when you use the SHOW TABLES command to display a list of datasheets, you will not be able to see the SalesSummary table. If you exit the current MySQL session and use the SELECT command to read the previously created temporary table data, you will find that the temporary table does not exist in the database because the temporary table was destroyed when you quit.

MySQL uses the temporary table simple method to tell you here, for other related issues you want to know can continue to follow our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report