How to create a temporary table in SQL Server and MySQL

Source: Internet
Author: User

SQL Server creates a temporary table:
Create temporary table
Method 1:
Create Table # temporary table name (Field 1 constraints,
Field 2 constraints,
.....)
Create Table # temporary table name (Field 1 constraints,
Field 2 constraints,
.....)
Method 2:
Select * into # temporary table name from your table;
Select * into # temporary table name from your table;
Note: The above # indicates a local temporary table, and # indicates a global temporary table.

Query temporary tables
Select * from # temporary table name;
Select * from # temporary table name;

Delete temporary table
Drop table # temporary table name;
Drop table # temporary table name;


Create a temporary table in MySQL
Create temporary table
Create temporary table name (Field 1 constraint,
Field 2 constraints,
.....)

Query temporary tables
Select * from temporary table name

Delete temporary table

Drop table temporary table name


for MySQL, you can create a temporary table on the MySQL command end. However, the temporary table cannot be created in phpMyAdmin. why?

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.