求一些常用的SQL代码语句

来源:百度知道 编辑:UC知道 时间:2024/05/26 09:31:28
只需要一些常用的,不需要太复杂,谢谢额。

查询select
更新update
删除内容delete
删除表 drop
插入 insert into

select 字段,字段(或用*显示全部字段) from 表 where 条件 order by 字段
where 条件 是可选的
order by 字段 是可选的 排序用的
order by 字段 desc 是倒序排列

举例
select 表1.字段,表2.字段 from 表1,表2 where 表1.id=表2.id and(或or) 表1.id between '4' and '15' and 表2.姓名 like '%张%'
like用来做模糊搜索
where语句也可用于下面

update 表 set 字段='15' where 条件

insert into 表1 (字段,字段……) select (字段,字段……) from 表2 where条件
insert into 表1 (字段,字段……) values (字段,字段……)

delete from 表 where 条件

最基本的就是
select
update
insert into
delete

用的活就是最强大的。
呼呼.飘过

select
update
insert into
delete