萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mysql教程 >> sql drop 刪除數據表方法

sql drop 刪除數據表方法

DROP tablename;
 
mysql教程>
mysql> CREATE TABLE Employee(
    ->     id            int,
    ->     first_name    VARCHAR(15),
    ->     last_name     CHAR(15),
    ->     start_date    DATE,
    ->     end_date      DATE,
    ->     salary        FLOAT(8,2),
    ->     city          VARCHAR(10),
    ->     description   VARCHAR(15)
    -> );
Query OK, 0 rows affected (0.06 sec)

mysql>
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| employee       |
+----------------+
1 row in set (0.00 sec)

mysql>
mysql> DROP table employee;
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> show tables;
Empty set (0.00 sec)
 
代碼好

mysql>
mysql> show tables;
Empty set (0.05 sec)

mysql>
mysql> CREATE TABLE Employee(
    ->     id            int,
    ->     first_name    VARCHAR(15),
    ->     last_name     VARCHAR(15),
    ->     start_date    DATE,
    ->     end_date      DATE,
    ->     salary        FLOAT(8,2),
    ->     city          VARCHAR(10),
    ->     description   VARCHAR(15)
    -> );
Query OK, 0 rows affected (0.03 sec)

mysql>
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| employee       |
+----------------+
1 row in set (0.00 sec)

mysql>
mysql>
mysql> DROP TABLE employee;
Query OK, 0 rows affected (0.02 sec)

copyright © 萬盛學電腦網 all rights reserved