SELECT L.C# As 课程ID,L.score AS 最高分,R.score AS 最低分 FROM SC L ,SC AS R WHERE L.C# = R.C# and L.score = (SELECT MAX(IL.score) FROM SC AS IL,Student AS IM WHERE L.C# = IL.C# and IM.S#=IL.S# GROUP BY IL.C#) AND R.Score = (SELECT MIN(IR.score) FROM SC AS I
尊重原创:http://blog.csdn.net/love_java_cc/article/details/78268326 有如下一张表score: 建表语句: CREATE TABLE `score` (`id` int NOT NULL AUTO_INCREMENT ,`name` varchar(20) NOT NULL ,`category` varchar(20) NOT NULL ,`score` int NOT NULL ); 现在要去查询学生的各科成绩和总分,效果如下
时间:2017-09-11 整理:byzqy 题目:用一条SQL语句查询出每门课都大于80分的学生姓名. 最近面试C#开发工程师,碰到上面这个考数据库的题目,自己感觉有点难度,没有思路,现将找到的解决方案整理如下: 文件:SQLQuery1.sql /* 环境:Microsoft SQL Server 2012 工具: Microsoft SQL Server Management Studio 数据库: Interview 数据表: grade 详情: name class score 张三
废话不说,直接建表 1.表Player USE T4st -- 设置当前数据库为T4st,以便访问sysobjects IF EXISTS(SELECT * FROM sysobjects WHERE name='Player') DROP TABLE Player CREATE TABLE Player ( Code ) PRIMARY KEY NOT NULL, Name ), ) ','赵甲'); ','钱乙'); ','孙丙'); ','李丁'); ','周戊'); ','吴已'); '
#include<stdio.h> int arr[102]={0};//分数作为自己的下标,注意 int main(){ int N;scanf("%d",&N); for(int i=0;i<N;i++){ int temp;scanf("%d",&temp); arr[temp]++; } int N2;scanf("%d",&N2); for(int i=1;i<=N2;i++){ if(i
--Student(S#,Sname,Sage,Ssex) 学生表 --Course(C#,Cname,T#) 课程表 --SC(S#,C#,score) 成绩表 --Teacher(T#,Tname) 教师表 --问题: --1.查询""课程比""课程成绩高的所有学生的学号: select a.S# from (select s#,score from SC where C#='001') a,(select s#,score from SC where C#='
Student(S#,Sname,Sage,Ssex) 学生表 Course(C#,Cname,T#) 课程表 SC(S#,C#,score) 成绩表 Teacher(T#,Tname) 教师表 问题: 1.查询“001”课程比“002”课程成绩高的所有学生的学号: select a.S# from (select s#,score from SC where C#='001') a,(select s#,score from SC where C#='002') b where a.score