建立數據表:mysql
mysql> use simonwangsql
Database changed數據庫
mysql> show tables;ide
Empty set (0.00 sec)spa
mysql> create table t1 (`id` int(4), `name` char(40));orm
Query OK, 0 rows affected (0.01 sec)it
插入數據:table
mysql> insert into studytable values(1,'test');class
Query OK, 1 row affected (0.00 sec)test
mysql> select * from studytable;
+------+------+
| id | name |
+------+------+
| 1 | test |
+------+------+
1 row in set (0.00 sec)
修改數據:
mysql> update studytable set name='updatetest' where id='1';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from studytable;
+------+------------+
| id | name |
+------+------------+
| 1 | updatetest |
+------+------------+
1 row in set (0.00 sec)
清空數據表:
mysql> truncate table studytable;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from studytable;
Empty set (0.00 sec)
刪除數據表:
mysql> drop table studytable;
Query OK, 0 rows affected (0.00 sec)
刪除數據庫:
mysql> drop database simonwang;
Query OK, 0 rows affected (0.01 sec)