MySQL Temporary Table
Programming in MySQL – Part 9
Foreword: In this part of the series, I talk about MySQL temporary table.
By: Chrysanthus Date Published: 27 May 2015
Temporary Table and Connection
A temporary table in MySQL is a table that exists as long as the connection is on. When a connection is dropped, the temporary table ceases to exist. The user who is connected is the one to use the temporary table.
In simple terms the syntax is:
CREATE TEMPORARY TABLE tbl_name
You can try the following:
CREATE TEMPORARY TABLE Women
WomanID INTEGER NOT NULL AUTO_INCREMENT,
PRIMARY KEY (WomanID ASC)
You can now go on to insert values into the temporary table. You can try the following:
INSERT INTO Women (Name, Address, City, State, Country, Phone) VALUES ('Mary', '50 Up Street', 'Fine York', 'California', 'U.S.A', '5555555555');
You can go on to select what you have inserted into the temporary table. You can try,
SELECT * FROM Women;
The temporary table lasts as long as the connection lasts.
Well, let us end here for this tutorial. We continue in the next part of the series.
Related LinksImplementing Database in MySQL
Programming in MySQL
Backup Basics in MySQL
MySQL Access Privileges
Regular Expressions in MySQL
Date and Time in MySQL
Event in MySQL
PurePerl MySQL API Prepared Statements
More Related Links
PurePerl MySQL Command Line Tool
Major in Website Design
Perl Course - Optimized
Web Development Course