问题6:
    横向显示学生每门课的成绩,总成绩,平均成绩,结果如下

    1. +-------+--------+--------+--------+-----------+--------------+
    2. | sname | 数学 | 语文 | 英语 | 总成绩 | 平均成绩 |
    3. +-------+--------+--------+--------+-----------+--------------+
    4. | Jack | 92 | 70 | 50 | 212 | 70.6667 |
    5. | Lucy | 98 | 86 | 88 | 272 | 90.6667 |
    6. | Mary | 55 | 70 | 90 | 215 | 71.6667 |
    7. | Tom | 75 | 55 | 40 | 170 | 56.6667 |
    8. +-------+--------+--------+--------+-----------+--------------+

    select
    sname,
    (select score from v_score vi where vi.cname = ‘数学’) 数学,
    (select score from v_score vi where vi.cname = ‘语文’) 语文,
    (select score from v_score vi where vi.cname = ‘英语’) 英语,
    sum(select score from v_score vi where sname = sname) 总成绩,
    avg(select score from v_score vi where sname = sname) 平均成绩
    from

    v_score vo
    group by sname;
    问题:
    1.SQL(2)直播课留下的问题6,我写出了上面的语句,有一定的问题,有报错,用到了子查询,要是按这个样写的话的该怎么改一下;
    通过各种修改
    报错的有
    ERROR 1242 (21000): Subquery returns more than 1 row
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘from v_score’ at line 6