求简单的SQL数据库增删改命令

如题所述

第1个回答  2019-03-02
mysql实例:
1、创建表create
table
t10
(id
int(10),name
varchar(20));
2、插入值insert
into
t10
values
(1,'kate'),(2,'ben'),(3,'tom');
3、清空表truncate
table
t10;
4、删一条delete
from
t10
where
id=1;
5、修改一条,update
t10
set
name='zhang
san'
where
id=2;
6、查询
select
*
from
t10;
select
count(*)
from
t10;
select
id,name
from
t10
order
by
id;
7、查看表结构desc
t10;
8、查看表创建语句:show
create
table
t10;
9、创建相同表结构的空表:
create
table
t11
select
*
from
t10
where
1=2;
10、从一个表获取数据插入另一个表
insert
into
t11
select
*
from
t10
where
id
>
2;
相似回答