MySQL tsim / tso lub rooj ib ntus li cas? Lub luag haujlwm ntawm MySQL cov ntxhuav ib ntus

MySQLYuav ua li cas los tsim / tso lub rooj temp?MySQLLub luag haujlwm ntawm cov rooj zaum ib ntus

MySQL ib ntus rooj

MySQL lub rooj ib ntus muaj txiaj ntsig zoo thaum peb xav tau khaws qee cov ntaub ntawv ib ntus.Cov ntxhuav ib ntus tsuas pom nyob rau hauv qhov kev sib txuas tam sim no.Thaum qhov kev sib txuas raug kaw, Mysql yuav rho tawm lub rooj thiab tso tag nrho qhov chaw.

Cov ntxhuav ib ntus tau ntxiv rau hauv MySQL version 3.23. Yog tias koj MySQL version qis dua version 3.23, koj siv tsis tau MySQL cov ntxhuav ib ntus.Txawm li cas los xij, nws tsis tshua muaj siv xws li qis version tam sim no.MySQL databasekev pabcuam.

Cov lus MySQL ib ntus tsuas yog pom ntawm qhov kev sib txuas tam sim no xwb. Yog tias koj siv PHP tsab ntawv los tsim MySQL lub rooj ib ntus, lub rooj ib ntus yuav raug puas tsuaj thaum twg PHP tsab ntawv raug tua.

Yog tias koj siv lwm qhov kev pabcuam MySQL tus neeg siv los txuas rau MySQL database server los tsim lub rooj ib ntus, lub rooj ib ntus tsuas yog raug rhuav tshem thaum cov neeg siv kev pabcuam raug kaw. Tau kawg, koj tuaj yeem rhuav tshem nws tus kheej.

piv txwv

Cov nram qab no qhia tau hais tias ib qho piv txwv yooj yim ntawm kev siv MySQL ib ntus cov lus, SQL code hauv qab no tuaj yeem siv rau mysql_query() kev ua haujlwm ntawm PHP tsab ntawv.

MySQL的> 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 ); 查询OK 0 行受影响0.00  
     
     
     

 

的MySQL > INSERT INTO SalesSummary - > PRODUCT_NAME TOTAL_SALES avg_unit_price total_units_sold - > VALUES
     - > '黄瓜' 100.25 90 2 );
     
        

mysql > SELECT * FROM SalesSummary ; + -------------- + ------------- + ---------------- + --- --------------- + | product_name | total_sales | avg_unit_price | total_units_sold | + -------------- + ------------- + ---------------- + --- --------------- + | 黄瓜      | 100.25 | 90.00 | 2 | + -------------- + ------------- + ---------------- + --- --------------- + 1 集合0.00 



                                   

  

thaum koj sivQHIA NTSWSThaum cov lus txib qhia txog cov ntawv teev cov ntaub ntawv, koj yuav tsis pom cov lus SalesSummary.

Yog tias koj tawm ntawm qhov kev sib tham MySQL tam sim no, ces sivXaivhais kom nyeem cov ntaub ntawv lub rooj ib ntus tsim, ces koj yuav pom tias lub rooj tsis muaj nyob hauv cov ntaub ntawv, vim tias lub rooj ib ntus tau raug rhuav tshem thaum koj tawm.


Tso MySQL ib ntus rooj

Los ntawm lub neej ntawd, cov ntxhuav ib ntus yuav raug puas tsuaj thaum koj txiav tawm ntawm cov ntaub ntawv.Tau kawg koj tuaj yeem siv hauv MySQL ntu tam sim noDROP TABLEtxib kom manually poob lub rooj ib ntus.

Cov hauv qab no yog ib qho piv txwv ntawm manually tso lub rooj ib ntus:

mysql> 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
);
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO SalesSummary
    -> (product_name, total_sales, avg_unit_price, total_units_sold)
    -> VALUES
    -> ('cucumber', 100.25, 90, 2);

mysql> SELECT * FROM SalesSummary;
+--------------+-------------+----------------+------------------+
| product_name | total_sales | avg_unit_price | total_units_sold |
+--------------+-------------+----------------+------------------+
| cucumber     |      100.25 |          90.00 |                2 |
+--------------+-------------+----------------+------------------+
1 row in set (0.00 sec)
mysql>DROP TABLE SalesSummary ; 
mysql >   SELECT * FROM SalesSummary ; 
错误1146 'chenweiliang.SalesSummary' 存在  

评论 评论

Koj email chaw nyob yuav tsis raug luam tawm. Yuav tsum tau siv cov liaj teb * Ntaus Cim

Scroll rau saum