码迷,mamicode.com
首页 > 数据库 > 详细

SQL面试题

时间:2016-06-28 20:32:35      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:

这是一个学生分数表

StudentName            StudySubject           SubjectScore

Peter                                 EN                               89

Peter                                 CH                               78

Peter                                 HO                               99

May                                   EN                               34

May                                   CH                               88

May                                   HO                               66

 

请用SQL 写出查询以下结果的脚本:

 

StudentName        EN         CH        HO

Peter                    89          78        99

May                      34          88        66

 

SELECT A.StudentName,A.SubjectScore as EN,B.SubjectScore as CH,C.SubjectScore as HO

From students A,students B,students C  

WHERE A.StudentName=B.StudentName AND B.StudentName=C.StudentName

AND A.StudySubject=‘语文‘ AND B.StudySubject=‘数学‘  

AND C.StudySubject=‘英语‘  

 

2016-06-28  19:11:01

 

SQL面试题

标签:

原文地址:http://www.cnblogs.com/Luoixie/p/5624720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!