【正文】
lect top 25 percent * from stu查詢A(ID,Name)表中第31至40條記錄,ID作為主鍵可能是不是連續(xù)增長的列,完整的查詢語句如下:select top 10 * from A where ID (select max(ID) from (select top 30 ID from A order by A ) T) order by A說出以下聚合數(shù)的含義:avg ,sum ,max ,min , count ,count(*)AVG:求平均值SUM:求和MAX:求最大值MIN:求最小值COUNT(*):返回所有行數(shù)1查詢平均成績大于60分的同學(xué)的學(xué)號(hào)和平均成績;selectstuId。avg(score)groupScores說明:隨機(jī)取出10條數(shù)據(jù)select top 10 * from tablename order by newid()查詢表A中存在ID重復(fù)三次以上的記錄,完整的查詢語句如下:select * from(select count(ID) as count from table group by ID)T where 310) 按照性別分組查詢所有的平均年齡Select avg(年齡) from stu group by 性別6) 刪除學(xué)生表的數(shù)據(jù),姓名以C開頭,性別為‘男’的記錄刪除Delect from stu where 性別=’男’ and 姓名 like ‘c%’