--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