Broad Network


MySQL While Statement

Programming in MySQL – Part 8

MySQL Course

Foreword: In this part of the series, I talk about MySQL while statement.

By: Chrysanthus Date Published: 27 May 2015

Introduction

This is part 9 of my series, Programming in MySQL. In this part of the series, I talk about MySQL temporary table. You should have read the previous parts of the series before reaching here, as this is a continuation.

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
    (create_definition,...);

You can try the following:

CREATE TEMPORARY TABLE Women
(
    WomanID INTEGER NOT NULL AUTO_INCREMENT,
    Name CHAR(40),
    Address CHAR(40),
    City CHAR(40),
    State CHAR(40),
    Country CHAR(40),
    Phone CHAR(40),

    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.

Chrys

Related Links

Implementing 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
MySQL Transaction
PurePerl MySQL API Prepared Statements
More Related Links
PurePerl MySQL Command Line Tool
Major in Website Design
Perl Course - Optimized
Web Development Course

BACK NEXT

Comments

Become the Writer's Fan
Send the Writer a Message