常见的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)
原文地址:https://www.cnblogs.com/runhua/p/9607357.html