mysql笔试_Mysql笔试题1.查询Student表中的所有记录的Sname、Ssex和Class列。
SELECT Sname,Ssex,Class FROM Students;
2.查询教师所有的单位即不重复的Depart列。
SELECT DISTINCT Depart FROM Teachers;
3.查询Student表的所有记录。
SELECT * FROM Students;
4.查询Score表中成绩在60到80之间的所有记录。
SELECT * FROM Scores WHERE Degree BETWEEN 60 AND 80;
5.查询Score表中成绩为85,86或88的记录。
dos命令移动文件installshield是什么SELECT * FROM Scores WHERE Degree IN (85,86,88);
6.查询Student表中“95031”班或性别为“⼥”的同学记录。
SELECT * FROM Students WHERE Class='95031' OR Ssex='⼥';
7.以Class降序查询Student表的所有记录。
SELECT * FROM Students ORDER BY Class DESC;
8.以Cno升序、Degree降序查询Score表的所有记录。
SELECT * FROM Scores ORDER BY Cno,Degree DESC;
乱七八糟的乱码复制9.查询“95031”班的学⽣⼈数。
SELECT COUNT(1) AS StuNum
FROM Students
WHERE Class='95031';
10.查询Score表中的最⾼分的学⽣学号和课程号。
mysql下载后的初次使用SELECT Sno,Cno FROM Scores ORDER BY Degree DESC LIMIT 1;
11.查询‘3-105’号课程的平均分。
SELECT AVG(Degree)
FROM Scores
WHERE Cno='3-105';
12.查询Score表中⾄少有5名学⽣选修的并以3开头的课程的平均分数。mysql面试题笔试
SELECT Cno,AVG(Degree)
FROM Scores
WHERE Cno LIKE '3%'
GROUP BY Cno
HAVING COUNT(Sno) >= 5;
13.查询最低分⼤于70,最⾼分⼩于90的Sno列。
SELECT Sno
FROM Scores
GROUP BY Sno
HAVING MAX(Degree)<90 AND MIN(Degree)>70;
14.查询所有学⽣的Sname、Cno和Degree列。SELECT Sname,Cno,Degree
FROM Students INNER JOIN Scores
ON(Students.Sno=Scores.Sno)
ORDER BY Sname;
15.查询所有学⽣的Sno、Cname和Degree列。SELECT Sno,Cname,Degree
FROM Scores INNER JOIN Courses
oracle分区表整理ON(Scores.Cno=Courses.Cno)
ORDER BY Sno;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论