--lect top 4 name as '姓名' from firstTable
/*
下面为汇集数据行
*/select
--计算出共有多少行
select COUNT(*) from firstTable 数据
select COUNT(name) from firstTable
--计算出id列全部值的和
select SUM(id) from firstTable
--计算出name列的max
select MAX(name) from firstTable
--计算出id列的max
select MAX(id) from firstTable查询
--计算id列的average的值
select AVG(id) from firstTabletop
/*
模糊查询 like
*/
select name from firstTable where name like '%z%_a%'co
/*
子查询 in/exists
*/
--若是表一中的id有表二中的id值,就打印出对应的name
select name as '表一的姓名' from firstTable where id in(select id from secondTable)ab
/* group by 分组 */ select age,COUNT(*) as '行数',SUM(id) as '和' from firstTable group by age