常見的sql操做

查詢全部14歲到18歲之間的男學生,並輸出他們的姓名和年齡:<br>Select Name, Age From<br>student Where sex = ‘male’ and age between 14 and 18
查詢全部姓名包含「妍」的學生:<br>Select * From student<br>Where name like 「%妍%」
統計表中學生涉及的院系個數:<br>Select<br>count(*)From (Select distinct Dept From student)
統計表中不一樣系別的男生的平均年齡,並按從大到小排列:<br>Select Dept, avg(Age)<br>From student Where sex = ‘male’ Group by Dept Order by avg(Age)
相關文章
相關標籤/搜索