1. 程式人生 > >mysql 創建臨時表

mysql 創建臨時表

pro varchar into har BE 數據 lec reat code

 

創建臨時表

create TEMPORARY table SalesSummary(
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 INTO SalesSummary
    (product_name, total_sales, avg_unit_price, total_units_sold)
    
VALUES (cucumber, 100.25, 90, 2); SELECT * from SalesSummary

刪除臨時表

DROP TABLE SalesSummary;

mysql 創建臨時表