首页 > 代码库 > SQL 学习日志03
SQL 学习日志03
添加表内容:
insert into table_name (字段1,字段2,...) values (值1,值2,....)
查询表内容:
select * from table_name
select 字段1,字段2 from table_name
select top 10 * from table_name
select * from table_name where 字段=值
select * from table_name where 字段<>值
select * from table_name where 字段 like ‘%值%‘
select * from table_name where 字段 in (值1,值2,...)
select * from table_name where 字段 in (select 字段 from table_name1)
select * from table_name where 字段 between 值1 and 值2
select * from table_name order by 字段 ASC(DESC)
select * from table_name order by 字段 ASC(DESC) limit 字段=值
select * from table_name group by 字段
select sum(字段) from table_name
select count(字段) from table_name
select AVG(字段) from table_name
select MAX/MIN(字段) from table_name
更新表内容:
update table_name set 字段=值 where 条件表达式
update table_name set 字段1=值1,字段2=值2,.... where 条件表达式
删除表内容:
delete from table_name where 条件表达式