天天看點

mysql增删改查

建立資料表:

mysql> use simonwang

Database changed

mysql> show tables;

Empty set (0.00 sec)

mysql> create table t1 (`id` int(4), `name` char(40));

Query OK, 0 rows affected (0.01 sec)

插入資料:

mysql> insert into studytable values(1,'test');

Query OK, 1 row affected (0.00 sec)

mysql> select * from studytable;

+------+------+

| id   | name |

|    1 | test |

1 row in set (0.00 sec)

修改資料:

mysql> update studytable set name='updatetest' where id='1';

Rows matched: 1  Changed: 1  Warnings: 0

+------+------------+

| id   | name       |

|    1 | updatetest |

清空資料表:

mysql> truncate table studytable;

Query OK, 0 rows affected (0.00 sec)

删除資料表:

mysql> drop table studytable;

删除資料庫:

mysql> drop database simonwang;

      本文轉自echoroot 51CTO部落格,原文連結:,http://blog.51cto.com/echoroot/1951818

如需轉載請自行聯系原作者