MySQL 基本语句记录
来源:互联网 发布:淘宝自动分销怎么取消 编辑:程序博客网 时间:2024/06/06 09:30
-- 查询
select column1,column2 from table
select column1,column2 from table where id = 1
-- 插入
insert into table (column1,column2) values (column_value1,column_value2)
-- 更新
update table set column1 = 'column_value1',column2 = 'column_value2' where id = 1
-- 删除
delete from table where id = 1
select * from table1 inner join table2 on table1.id = table2.id
-- 左右连接查询
select * from table1 right join table2 on table1.id = table2.id
select * from table1 left join table2 on table1.id = table2.id
-- 全连接查询
select * from table1 right join table2 on table1.id = table2.id
union
select * from table1 left join table2 on table1.id = table2.id
-- 排序
select * from table1 order by id
select * from table2 order by id desc
-- 统计
select max(id) from table1
select min(id) from table1
select sum(id) from table1
select avg(id) from table1
select count(id) from table1 where pid = 1
select count(id) from table1 where table1.pid = table2.pid group by table1.pid
-- 限制查询
select * from table1 limit 0,5
select column1,column2 from table
select column1,column2 from table where id = 1
-- 插入
insert into table (column1,column2) values (column_value1,column_value2)
-- 更新
update table set column1 = 'column_value1',column2 = 'column_value2' where id = 1
-- 删除
delete from table where id = 1
-- 内连接查询
select * from table1,table2 where table1.id = table2.idselect * from table1 inner join table2 on table1.id = table2.id
-- 左右连接查询
select * from table1 right join table2 on table1.id = table2.id
select * from table1 left join table2 on table1.id = table2.id
-- 全连接查询
select * from table1 right join table2 on table1.id = table2.id
union
select * from table1 left join table2 on table1.id = table2.id
-- 排序
select * from table1 order by id
select * from table2 order by id desc
-- 统计
select max(id) from table1
select min(id) from table1
select sum(id) from table1
select avg(id) from table1
select count(id) from table1 where pid = 1
select count(id) from table1 where table1.pid = table2.pid group by table1.pid
-- 限制查询
select * from table1 limit 0,5
0 0
- MySQL 基本语句记录
- mysql 记录语句记录
- MYSQL 语句记录
- 常用mysql语句记录
- mysql语句记录
- mysql语句记录
- mysql 语句记录一下
- MYSQL语句记录
- mysql查询语句记录
- Mysql常用语句记录
- mysql语句记录
- MYSQL语句使用记录
- mysql 常用语句记录
- mysql 语句记录
- MySQL 语句记录
- mysql语句记录
- mysql基本语句
- mysql基本语句
- Android项目如何知晓当前运行的是哪个活动
- Podometer计步器
- C++第四次实验
- HDU2058 找规律+递推
- spring
- MySQL 基本语句记录
- java内存泄漏的定位与分析
- 记录webservice
- Access denied for user 'xxx'@'localhost.localdomain' (using password: YES))
- More Effective C++----效率 & (16)牢记80-20准则(80-20 rule)
- 51nod 1732 51nod婚姻介绍所
- VC6.0调试技巧 (一)
- MVC,MVP 和 MVVM 的图示
- 平面内两条线段的位置关系(相交)判定与交点求解