Create, Drop a temporary table in MySQL

80
Views
1
Answers

How to create, drop a temporary table in MySql and insert some data to the created temporary table?

edit | flag
William Patrick
Asked on: Dec 10, 2011 at 12:29AM

1 Answers

89
1
89

Create Query

 CREATE TEMPORARY TABLE Products(
    product_name VARCHAR
(50) NOT NULL,
    total_sales DECIMAL
(12,2) NOT NULL DEFAULT 0.00,
    avg_unit_price DECIMAL
(7,2) NOT NULL DEFAULT 0.00,
    total_units_sold INT UNSIGNED NOT NULL DEFAULT
0);

Insert Query

 INSERT INTO Products
 
(product_name, total_sales, avg_unit_price, total_units_sold)
   VALUES
 
('product', 1000.25, 900, 200);

Select Query

SELECT * FROM SalesSummary;

Drop Query

DROP TABLE SalesSummary;
edit | flag
Gokul A
Answered on: Dec 10, 2011 at 12:34AM

Post your Answer

Search

Welcome to Ask Amoeba!
This is 100% free and interactive site for sharing professional Questions and Answers, Opensource projects, Interview questions.
Learners, beginners, Experts stop and share your knowledge and ideas!

Browse Categories

Browse Tags