2019-10-17

50道SQL练习题

来自https://www.jianshu.com/p/476b52ee4f1b

sql语句的执行顺序

(9)Select
(10)distinct 字段名1,字段名2,
(7)[fun(字段名)]
(1)from 表1
(3)<join类型>join 表2
(2)on <join条件>
(4)where <where条件>
(5)group by <字段>
(6)with <cube|rollup>
(8)having <having条件>
(11)order by <排序字段>
(12)limit <起始偏移量,行数>

学生表 Student

create table Student(SId varchar(10),Sname varchar(10),Sage datetime,Ssex varchar(10));
insert into Student values('01' , '赵雷' , '1990-01-01' , '男');
insert into Student values('02' , '钱电' , '1990-12-21' , '男');
insert into Student values('03' , '孙风' , '1990-12-20' , '男');
insert into Student values('04' , '李云' , '1990-12-06' , '男');
insert into Student values('05' , '周梅' , '1991-12-01' , '女');
insert into Student values('06' , '吴兰' , '1992-01-01' , '女');
insert into Student values('07' , '郑竹' , '1989-01-01' , '女');
insert into Student values('09' , '张三' , '2017-12-20' , '女');
insert into Student values('10' , '李四' , '2017-12-25' , '女');
insert into Student values('11' , '李四' , '2012-06-06' , '女');
insert into Student values('12' , '赵六' , '2013-06-13' , '女');
insert into Student values('13' , '孙七' , '2014-06-01' , '女');

科目表 Course

create table Course(CId varchar(10),Cname nvarchar(10),TId varchar(10));
insert into Course values('01' , '语文' , '02');
insert into Course values('02' , '数学' , '01');
insert into Course values('03' , '英语' , '03');

教师表 Teacher

create table Teacher(TId varchar(10),Tname varchar(10));
insert into Teacher values('01' , '张三');
insert into Teacher values('02' , '李四');
insert into Teacher values('03' , '王五');

成绩表 SC

create table SC(SId varchar(10),CId varchar(10),score decimal(18,1));
insert into SC values('01' , '01' , 80);
insert into SC values('01' , '02' , 90);
insert into SC values('01' , '03' , 99);
insert into SC values('02' , '01' , 70);
insert into SC values('02' , '02' , 60);
insert into SC values('02' , '03' , 80);
insert into SC values('03' , '01' , 80);
insert into SC values('03' , '02' , 80);
insert into SC values('03' , '03' , 80);
insert into SC values('04' , '01' , 50);
insert into SC values('04' , '02' , 30);
insert into SC values('04' , '03' , 20);
insert into SC values('05' , '01' , 76);
insert into SC values('05' , '02' , 87);
insert into SC values('06' , '01' , 31);
insert into SC values('06' , '03' , 34);
insert into SC values('07' , '02' , 89);
insert into SC values('07' , '03' , 98);
1.查询" 01 "课程比" 02 "课程成绩高的学生的信息及课程分数
SELECT
    * 
FROM
    Student s 
WHERE
    s.SId IN (
    SELECT
        sc1.SId 
    FROM
        SC sc1
        JOIN SC sc2 ON sc1.SId = sc2.SId 
        AND sc1.CId = '01' 
        AND sc2.CId = '02' 
    AND sc1.score > sc2.score 
    );
2.查询同时存在" 01 "课程和" 02 "课程的学生情况
SELECT
    * 
FROM
    Student s 
WHERE
    s.SId IN (
    SELECT
        sc1.SId 
    FROM
        SC sc1
        JOIN SC sc2 ON sc1.CId = '01' 
        AND sc2.CId = '02' 
    AND sc1.SId = sc2.SId 
    );
3.查询存在" 01 "课程但不存在" 02 "课程的学生情况(不存在时显示为 null )
SELECT
    * 
FROM
    Student s 
WHERE
    s.SId IN (
    SELECT
        sc1.SId 
    FROM
        ( SELECT * FROM SC WHERE SC.CId = '01' ) AS sc1
        LEFT JOIN ( SELECT * FROM SC WHERE SC.CId = '02' ) AS sc2 ON sc1.SId = sc2.SId 
    WHERE
    sc2.SId IS NULL 
    );
4.查询不存在" 01 "课程但存在" 02 "课程的学生情况
SELECT
    s.* 
FROM
    Student s,
    (
    SELECT
        sc2.SId 
    FROM
        ( SELECT * FROM SC WHERE SC.CId = '01' ) AS sc1
        RIGHT JOIN ( SELECT * FROM SC WHERE SC.CId = '02' ) AS sc2 ON sc1.SId = sc2.SId 
    WHERE
        sc1.SId IS NULL 
    ) AS sc2id 
WHERE
    s.SId = sc2id.SId;
5.查询平均成绩大于等于 60 分的同学的学生编号和学生姓名和平均成绩
SELECT
    s.SId,
    s.Sname,
    avgs1.as1 
FROM
    Student s,
    ( SELECT SId, AVG( score ) AS as1 FROM SC GROUP BY SId HAVING AVG( score ) > 60 ) AS avgs1 
WHERE
    s.SId = avgs1.SId;
6.查询在 SC 表存在成绩的学生信息
SELECT DISTINCT
    s.* 
FROM
    Student s,
    SC 
WHERE
    s.SId = SC.SId;
7.查询所有同学的学生编号、学生姓名、选课总数、所有课程的成绩总和
SELECT
    s.SId,
    s.Sname,
    sccs.scc,
    sccs.scs 
FROM
    Student s
    LEFT JOIN (
    SELECT
        SC.SId,
        COUNT( SC.CId ) AS scc,
        SUM( SC.score ) AS scs 
    FROM
        SC 
    GROUP BY
    SC.SId 
    ) AS sccs ON s.SId = sccs.SId;

8.查有成绩的学生信息
SELECT
    * 
FROM
    Student s 
WHERE
    EXISTS ( SELECT SC.SId FROM SC WHERE SC.SId = s.SId );
9.查询「李」姓老师的数量
SELECT
    COUNT( * ) 
FROM
    Teacher 
WHERE
    Tname LIKE '李%';
10.查询学过「张三」老师授课的同学的信息
SELECT
    s.* 
FROM
    Teacher t,
    Course c,
    SC,
    Student s 
WHERE
    t.Tname = '张三' 
    AND t.TId = c.TId 
    AND SC.CId = c.CId 
    AND s.SId = SC.SId;
11.查询没有学全所有课程的同学的信息
SELECT
    * 
FROM
    Student s 
WHERE
    s.SId NOT IN (
    SELECT
        SC.SId 
    FROM
        SC 
    GROUP BY
        SC.SId 
    HAVING
    COUNT( SC.CId ) = ( SELECT COUNT( c.CId ) FROM Course c ) 
    );
12.查询至少有一门课与学号为" 01 "的同学所学相同的同学的信息
SELECT DISTINCT
    s.* 
FROM
    ( SELECT * FROM SC WHERE SC.SId = '01' ) AS sc1
    JOIN ( SELECT * FROM SC WHERE SC.SId != '01' ) AS sc2
    JOIN Student s 
WHERE
    sc1.CId = sc2.CId 
    AND s.SId = sc2.SId;
13.查询和" 01 "号的同学学习的课程完全相同的其他同学的信息
SELECT
    SId 
FROM
    SC 
WHERE
    CId IN ( SELECT SC.CId FROM SC WHERE SC.SId = '01' ) 
GROUP BY
    SC.SId 
HAVING
    COUNT( * ) = ( SELECT COUNT( * ) FROM SC WHERE SC.SId = '01' ) 
    AND SC.SId != '01';

但是如果SId='02'增加一条CId='04',按照上面的语句也是符合条件。因为第三行的语句把这种CId='04'给过滤了。

SELECT
    * 
FROM
    Student 
WHERE
    SId IN (
    SELECT
        SId 
    FROM
        SC 
    GROUP BY
        SId 
    HAVING
        GROUP_CONCAT( CId ) = ( SELECT GROUP_CONCAT( CId ) FROM SC WHERE SId = '01' ) 
    AND SId != '01' 
    );
14.查询没学过"张三"老师讲授的任一门课程的学生姓名
SELECT
    s.SName 
FROM
    Student s 
WHERE
    s.SId NOT IN (
    SELECT
        SC.SId 
    FROM
        Teacher t,
        Course c,
        SC 
    WHERE
        t.Tname = '张三' 
        AND t.TId = c.TId 
    AND SC.CId = c.CId 
    );
15.查询两门及其以上不及格课程的同学的学号,姓名及其平均成绩
SELECT
    s.SId,
    s.Sname,
    AVG( SC.score ) 
FROM
    SC,
    Student s 
WHERE
    s.SId = SC.SId 
    AND SC.score < 60 GROUP BY SC.SId HAVING COUNT( * ) > 1;
16.检索" 01 "课程分数小于 60,按分数降序排列的学生信息
SELECT
    s.*,
    SC.score 
FROM
    SC,
    Student s 
WHERE
    SC.CId = '01' 
    AND SC.score < 60 
    AND SC.SId = s.SId 
ORDER BY
    SC.score DESC;
17.按平均成绩从高到低显示所有学生的所有课程的成绩以及平均成绩
SELECT
    SC.*,
    sc1.avgs 
FROM
    SC
    LEFT JOIN ( SELECT SId, AVG( SC.score ) AS avgs FROM SC GROUP BY SId ) AS sc1 ON SC.SId = sc1.SId 
ORDER BY
    sc1.avgs DESC;
18.查询各科成绩最高分、最低分和平均分:

以如下形式显示:课程 ID,课程 name,最高分,最低分,平均分,及格率,中等率,优良率,优秀率
及格为>=60,中等为:70-80,优良为:80-90,优秀为:>=90
要求输出课程号和选修人数,查询结果按人数降序排列,若人数相同,按课程号升序排列

SELECT
    SC.CId,
    c.Cname,
    MAX( SC.score ) AS tops,
    MIN( SC.score ) AS lows,
    AVG( SC.score ) AS avgs,
    COUNT( * ) AS nump,
    SUM( CASE WHEN SC.score >= 60 THEN 1 ELSE 0 END ) / COUNT( * ) AS pasr,
    SUM( CASE WHEN SC.score >= 70 AND SC.score < 80 THEN 1 ELSE 0 END ) / COUNT( * ) AS medr,
    SUM( CASE WHEN SC.score >= 90 THEN 1 ELSE 0 END ) / COUNT( * ) AS excr 
FROM
    SC,
    Course c 
WHERE
    SC.CId = c.CId 
GROUP BY
    SC.CId 
ORDER BY
    COUNT( * ) DESC,
    SC.CId ASC;
19.按各科成绩进行排序,并显示排名, Score 重复时保留名次空缺
SELECT
    sc1.CId,
    sc1.SId,
    COUNT( sc2.score ) + 1 rank 
FROM
    SC sc1
    LEFT JOIN SC sc2 ON sc1.CId = sc2.CId 
    AND sc1.score < sc2.score 
GROUP BY
    sc1.CId,
    sc1.SId 
ORDER BY
    sc1.CId,
    rank;
查询学生的总成绩,并进行排名,总分重复时不保留名次空缺
SET @rank := 0;
SELECT
    sc.SId,
    total,
    @rank := @rank + 1 AS Rank 
FROM
    ( SELECT SC.SId, SUM( SC.score ) AS total FROM SC GROUP BY SC.SId ORDER BY total DESC ) sc;
20.统计各科成绩各分数段人数:课程编号,课程名称,[100-85],[85-70],[70-60],[60-0] 及所占百分比
SELECT
    Course.CId,
    Course.Cname,
    p1.`[100-85]`,
    p1.`[100-85]%`,
    p2.`[85-70]`,
    p2.`[85-70]%`,
    p3.`[70-60]`,
    p3.`[70-60]%`,
    p4.`[60-0]`,
    p4.`[60-0]%` 
FROM
    Course
    LEFT JOIN (
    SELECT
        CId,
        SUM( CASE WHEN SC.score <= 100 AND SC.score > 85 THEN 1 ELSE 0 END ) AS `[100-85]`,
        ROUND(
            (
                SUM( CASE WHEN SC.score <= 100 AND SC.score > 85 THEN 1 ELSE 0 END ) * 100 / COUNT( * ) 
            ),
            2 
        ) `[100-85]%` 
    FROM
        SC 
    GROUP BY
        SC.CId 
    ) p1 ON Course.CId = p1.CId
    LEFT JOIN (
    SELECT
        CId,
        SUM( CASE WHEN SC.score <= 85 AND SC.score > 70 THEN 1 ELSE 0 END ) AS `[85-70]`,
        ROUND(
            (
                SUM( CASE WHEN SC.score <= 85 AND SC.score > 70 THEN 1 ELSE 0 END ) * 100 / COUNT( * ) 
            ),
            2 
        ) AS `[85-70]%` 
    FROM
        SC 
    GROUP BY
        SC.CId 
    ) AS p2 ON Course.CId = p2.CId
    LEFT JOIN (
    SELECT
        CId,
        SUM( CASE WHEN SC.score <= 70 AND SC.score > 60 THEN 1 ELSE 0 END ) AS `[70-60]`,
        ROUND(
            (
                SUM( CASE WHEN SC.score <= 70 AND SC.score > 60 THEN 1 ELSE 0 END ) * 100 / COUNT( * ) 
            ),
            2 
        ) AS `[70-60]%` 
    FROM
        SC 
    GROUP BY
        SC.CId 
    ) AS p3 ON Course.CId = p3.CId
    LEFT JOIN (
    SELECT
        CId,
        SUM( CASE WHEN SC.score <= 60 AND SC.score > 0 THEN 1 ELSE 0 END ) AS `[60-0]`,
        ROUND(
            (
                SUM( CASE WHEN SC.score <= 60 AND SC.score > 0 THEN 1 ELSE 0 END ) * 100 / COUNT( * ) 
            ),
            2 
        ) AS `[60-0]%` 
    FROM
        SC 
    GROUP BY
    SC.CId 
    ) AS p4 ON Course.CId = p4.CId;
21.查询各科成绩前三名的记录
SELECT
    sc1.* 
FROM
    SC sc1
    LEFT JOIN SC sc2 ON sc1.CId = sc2.CId 
    AND sc1.score < sc2.score 
GROUP BY
    sc1.SId,
    sc1.CId 
HAVING
    COUNT( sc2.CId ) < 3 
ORDER BY
    sc1.CId;
22.查询每门课程被选修的学生数
SELECT
    CId,
    COUNT( SId ) 
FROM
    SC 
GROUP BY
    CId;
23.查询出只选修两门课程的学生学号和姓名
SELECT
    Student.SId,
    Student.Sname 
FROM
    SC,
    Student 
WHERE
    SC.SId = Student.SId 
GROUP BY
    SC.SId 
HAVING
    COUNT( * ) = 2;
24.查询男生、女生人数
SELECT
    Ssex,
    COUNT( * ) 
FROM
    Student 
GROUP BY
    Ssex;
25.查询名字中含有「风」字的学生信息
SELECT
    * 
FROM
    Student 
WHERE
    Sname LIKE '%风%';
26.查询同名学生名单,并统计同名人数
SELECT
    Sname,
    COUNT( * ) 
FROM
    Student 
GROUP BY
    Sname 
HAVING
    COUNT( * ) > 1;
27.查询 1990 年出生的学生名单
SELECT
    * 
FROM
    Student 
WHERE
    YEAR ( Sage ) = 1990;
28.查询每门课程的平均成绩,结果按平均成绩降序排列,平均成绩相同时,按课程编号升序排列
SELECT
    SC.CId,
    Course.Cname,
    AVG( SC.score ) AS average 
FROM
    SC,
    Course 
WHERE
    SC.CId = Course.CId 
GROUP BY
    SC.CId 
ORDER BY
    average DESC,
    CId;
29.查询平均成绩大于等于 85 的所有学生的学号、姓名和平均成绩
SELECT
    Student.SId,
    Student.Sname,
    AVG( SC.score ) AS average 
FROM
    Student,
    SC 
WHERE
    Student.SId = SC.SId 
GROUP BY
    SC.SId 
HAVING
    average >= 85;
30.查询课程名称为「数学」,且分数低于 60 的学生姓名和分数
SELECT
    Student.Sname,
    SC.score 
FROM
    Course,
    SC,
    Student 
WHERE
    Course.Cname = "数学" 
    AND Course.CId = SC.CId 
    AND SC.score < 60 
    AND Student.SId = SC.SId;
31.查询所有学生的课程及分数情况(存在学生没成绩,没选课的情况)
SELECT
    Sname,
    CId,
    score 
FROM
    Student
    LEFT JOIN SC USING ( SId );
32.查询任何一门课程成绩在 70 分以上的姓名、课程名称和分数
SELECT
    Student.Sname,
    Course.Cname,
    SC.score 
FROM
    SC,
    Student,
    Course 
WHERE
    SC.score > 70 
    AND Student.SId = SC.SId 
    AND SC.CId = Course.CId;
33.查询存在不及格的课程
SELECT DISTINCT
    SC.CId 
FROM
    SC 
WHERE
    SC.score < 60;
34.查询课程编号为 01 且课程成绩在 80 分及以上的学生的学号和姓名
SELECT
    Student.SId,
    Student.Sname 
FROM
    Student,
    SC 
WHERE
    Student.SId = SC.SId 
    AND CId = "01" 
    AND score >= 80;
35.求每门课程的学生人数
SELECT
    SC.CId,
    COUNT( * ) AS sn 
FROM
    SC 
GROUP BY
    CId;
36.成绩不重复,查询选修「张三」老师所授课程的学生中,成绩最高的学生信息及其成绩
SELECT
    Student.*,
    SC.CId,
    SC.score 
FROM
    Teacher,
    Course,
    SC,
    Student 
WHERE
    Teacher.Tname = "张三" 
    AND Teacher.TId = Course.TId 
    AND Course.CId = SC.CId 
    AND SC.SId = Student.SId 
ORDER BY
    SC.score DESC 
    LIMIT 1;
37.成绩有重复的情况下,查询选修「张三」老师所授课程的学生中,成绩最高的学生信息及其成绩
SELECT Student.*,SC.CId,SC.score 
    FROM Teacher,Course,SC,Student
    WHERE Teacher.Tname="张三"
    AND Teacher.TId=Course.TId
    AND Course.CId=SC.CId 
    AND SC.SId=Student.SId 
    AND SC.score=
    (SELECT MAX(SC.score)
    FROM Teacher,Course,SC,Student
    WHERE Teacher.Tname="张三"
    AND Teacher.TId=Course.TId
    AND Course.CId=SC.CId 
    AND SC.SId=Student.SId );
38.查询不同课程成绩相同的学生的学生编号、课程编号、学生成绩
SELECT
    sc1.* 
FROM
    SC sc1
    JOIN SC sc2 USING ( SId ) 
WHERE
    sc1.CId != sc2.CId 
    AND sc1.score = sc2.score 
GROUP BY
    sc1.CId;
39.查询每门课程成绩最好的前两名
SELECT
    sc1.* 
FROM
    SC sc1
    LEFT JOIN SC sc2 ON sc1.CId = sc2.CId 
    AND sc1.score < sc2.score 
GROUP BY
    sc1.SId,
    sc1.CId 
HAVING
    COUNT( sc2.CId ) < 2 
ORDER BY
    sc1.CId;
40.统计每门课程的学生选修人数(超过 5 人的课程才统计)
SELECT
    SC.CId,
    COUNT( SId ) AS cc 
FROM
    SC 
GROUP BY
    CId 
HAVING
    cc > 5;
41.检索至少选修两门课程的学生学号
SELECT
    SC.SId,
    COUNT( SId ) AS cc 
FROM
    SC 
GROUP BY
    SId 
HAVING
    cc >= 2;
42.查询选修了全部课程的学生信息
SELECT
    Student.* 
FROM
    SC,
    Student 
WHERE
    SC.SId = Student.SId 
GROUP BY
    SC.SId 
HAVING
    COUNT( * ) = ( SELECT COUNT( * ) FROM Course );
43.查询各学生的年龄,只按年份来算
SELECT
    SId,
    Sname,
    YEAR ( CURDATE( ) ) - YEAR ( Sage ) AS age 
FROM
    Student;
44.按照出生日期来算,当前月日 < 出生年月的月日则,年龄减一
SELECT
    SId,
    Sname,
    TIMESTAMPDIFF( YEAR, Sage, CURDATE( ) ) AS age 
FROM
    Student;
45.查询本周过生日的学生
SELECT
    * 
FROM
    Student 
WHERE
    WEEKOFYEAR( Sage ) = WEEKOFYEAR( CURDATE( ) );
查询下周过生日的学生
SELECT
    * 
FROM
    Student 
WHERE
    WEEKOFYEAR( Sage ) = WEEKOFYEAR( CURDATE( ) ) + 1;
46.查询本月过生日的学生
SELECT
    * 
FROM
    Student 
WHERE
    MONTH ( Sage ) = MONTH ( CURDATE( ) );
47.查询下月过生日的学生
SELECT
    * 
FROM
    Student 
WHERE
    MONTH ( Sage ) = MONTH ( CURDATE( ) ) + 1;
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 214,658评论 6 496
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,482评论 3 389
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 160,213评论 0 350
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,395评论 1 288
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,487评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,523评论 1 293
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,525评论 3 414
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,300评论 0 270
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,753评论 1 307
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,048评论 2 330
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,223评论 1 343
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,905评论 5 338
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,541评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,168评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,417评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,094评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,088评论 2 352

推荐阅读更多精彩内容

  • 网上流传较广的50道SQL训练,奋斗了不知道多久终于写完了。前18道题的难度依次递增,从19题开始的后半部分算是循...
    Kaidi_G阅读 474,463评论 312 452
  • 50道SQL练习题及答案与详细分析 https://www.jianshu.com/p/cc23c19ef639[...
    将代码写成诗阅读 2,248评论 0 3
  • 一,表关系的练习测试 请创建如下表关系,并建立相关约束 一,创建表结构数据: 创建的话肯定先创建没有关联的表,老师...
    Kevin_Luo阅读 2,792评论 0 0
  • 练习前的准备 SQL环境搭建 https://www.jianshu.com/p/edca5142391c 建表语...
    TOMOCAT阅读 23,516评论 3 30
  • 我使用的Mysql版本是5.7.19。答案可能会因版本会有少许出入。如果答案有问题欢迎在评论区指出并给出你的答案。...
    大石兄阅读 16,477评论 8 21