返回列表 发帖

四种简单的sql语句(增删改查语句)

一、插入语句
insert into [table] ([column],[column],[column])
values(?,?,?)
二、删除语句
delete
from [table]
where column = ?
三、修改语句
update [table]
set column = ?
where column = ?
四、查询语句
1)查询单条记录的所有字段
select *
from [table]
where [column] = ?
2)查询所有记录的所有字段
select *
from [table]
order by [column] asc
注意:

1.order by column asc代表:以column字段,升序排列。desc为降序
3)查询给定偏移量的记录的所有字段
select *
from [table]
limit [offset], [limit]
注意:

1.offset指定从哪个索引开始,默认从0开始
2.limit指定查询几条记录
4)查询指定记录的指定字段
select [column], [column]
form [table]
where [column] = ?

返回列表