一、建表的结构和数据,在sqlserver直接用就行了

USE [test]
GO
/****** Object: Table [dbo].[TEACHER] Script Date: 05/16/2018 16:27:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TEACHER](
[T#] [int] NOT NULL,
[TNAME] [nvarchar]() NOT NULL,
PRIMARY KEY CLUSTERED
(
[T#] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'李冰冰')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'黄一山')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'陈小春')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'赵铁柱')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'钱中书')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'孙悟空')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'李连杰')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'杨千嬅')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'泽日生')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'林夕')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'陈奕迅')
INSERT [dbo].[TEACHER] ([T#], [TNAME]) VALUES (, N'刘备')
/****** Object: Table [dbo].[STUDENT] Script Date: 05/16/2018 16:27:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[STUDENT](
[S#] [int] NOT NULL,
[SNAME] [nvarchar]() NOT NULL,
[SAGE] [int] NOT NULL,
[SSEX] [char]() NOT NULL,
PRIMARY KEY CLUSTERED
(
[S#] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小红', , N'女')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小明', , N'男')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小绿', , N'男')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小蓝', , N'男')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小青', , N'男')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小白', , N'女')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小紫', , N'女')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小黄', , N'男')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小粉', , N'女')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小橙', , N'女')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小黑', , N'男')
INSERT [dbo].[STUDENT] ([S#], [SNAME], [SAGE], [SSEX]) VALUES (, N'小粉', , N'男')
/****** Object: Table [dbo].[SC] Script Date: 05/16/2018 16:27:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SC](
[S#] [int] NULL,
[C#] [nvarchar]() NULL,
[SCORE] [int] NOT NULL
) ON [PRIMARY]
GO
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
GO
print 'Processed 100 total records'
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
INSERT [dbo].[SC] ([S#], [C#], [SCORE]) VALUES (, N'', )
/****** Object: Table [dbo].[COURSE] Script Date: 05/16/2018 16:27:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[COURSE](
[C#] [int] NOT NULL,
[CNAME] [nvarchar]() NOT NULL,
[T#] [nvarchar]() NOT NULL,
PRIMARY KEY CLUSTERED
(
[C#] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'语文1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'语文2', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'数学1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'数学2', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'英语1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'英语2', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'生物1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'生物2', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'物理1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'物理2', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'化学1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'化学2', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'政治1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'政治2', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'历史1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'历史2', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'地理1', N'')
INSERT [dbo].[COURSE] ([C#], [CNAME], [T#]) VALUES (, N'地理2', N'')

二、表的数据截图

1、学生表 :学号、姓名、姓别

2、教师表:编号,名称

3、课程表:课程编号、课程、老师编号

4、分数表:学号、课程号、分数

5、数据准备好后正式开始题目

--1、查询“111”课程比“112”课程成绩高的所有学生的学号;
/* EXISTS 版本 */
SELECT t1.s#
FROM sc t1
WHERE t1.c# = 111
AND EXISTS (
SELECT 1
FROM sc t2
WHERE t2.c# = 112
AND t1.s# = t2.s# --要求同一个学生 所以有t1.s# = t2.s#
AND t1.score > t2.score
);
/* 子查询版本 */
SELECT a.s#
FROM (SELECT t1.s#,t1.score FROM sc t1 WHERE t1.c# = 111) a
INNER JOIN (SELECT t2.s#,t2.score FROM sc t2 WHERE t2.c# = 112) b
ON a.s# = b.s#
WHERE a.score > b.score; --2、查询平均成绩大于60分的同学的学号和平均成绩;
SELECT t1.s# AS ST_CODE,
AVG(t1.score) AS CU_AVG
FROM sc t1
GROUP BY t1.s#
HAVING AVG(t1.score) > 60 --3、查询所有同学的学号、姓名、选课数、总成绩;
/* group by 的时候要注意选出来的字段是不是都是聚合函数或者分组的字段 */
SELECT t1.s# AS ST_DOCE,
MIN(t1.sname) AS ST_NAME,
COUNT(t2.c#) AS CU_NUM,
SUM(t2.score) AS CU_SUM
FROM STUDENT t1
LEFT JOIN SC t2
ON t1.s# = t2.s#
GROUP BY t1.s# --4、查询姓“李”的老师的个数;
SELECT COUNT(t1.t#) AS 李_NUM
FROM teacher t1
WHERE t1.tname LIKE '李%' --5、查询没学过'陈奕迅'老师课的同学的学号、姓名;
/* 一对多关系的就会出现比较坑爹的情况,记得用distinct并且要考虑是不是要做一个子查询 */
/* 当正面来可能比较困难的时候就要反方面来进行 */
/* EXISTS版 */
SELECT t5.s# AS ST_CODE,
t5.sname AS ST_NAME
FROM student t5
WHERE NOT EXISTS (
SELECT 1
FROM (
SELECT DISTINCT t1.s# AS ST_CODE,
t1.sname AS ST_NAME,
t4.tname
FROM student t1
LEFT JOIN sc t2
ON t1.s# = t1.s#
LEFT JOIN course t3
ON t2.c# = t3.c#
LEFT JOIN teacher t4
ON t3.t# = t4.t#
WHERE t4.tname = '陈奕迅'
)
WHERE s# = t5.s#
);
/* 子查询版 */
SELECT t5.s# AS ST_CODE,
t5.sname AS ST_NAME
FROM student t5
WHERE t5. EXISTS (
SELECT 1
FROM (
SELECT DISTINCT t1.s# AS ST_CODE,
t1.sname AS ST_NAME,
t4.tname
FROM student t1
LEFT JOIN sc t2
ON t1.s# = t1.s#
LEFT JOIN course t3
ON t2.c# = t3.c#
LEFT JOIN teacher t4
ON t3.t# = t4.t#
WHERE t4.tname = '陈奕迅'
)
WHERE s# = t5.s#
); --6、查询学过“001”并且也学过编号“002”课程的同学的学号、姓名;
--不能在where条件下面写WHERE t2.c# = 111 and t2.c# = 112 因为是对应同一条记录的
SELECT DISTINCT t1.s#,t1.sname
FROM student t1
LEFT JOIN sc t2
ON t1.s# = t2.s#
WHERE t2.c# = 111 INTERSECT --集合的交集 SELECT DISTINCT t1.s#,t1.sname
FROM student t1
LEFT JOIN sc t2
ON t1.s# = t2.s#
WHERE t2.c# = 112 --7、查询学过“叶平”老师所教的所有课的同学的学号、姓名;
SELECT DISTINCT t1.s# AS ST_CODE,
t1.sname AS ST_NAME,
FROM student t1
LEFT JOIN sc t2
ON t1.s# = t1.s#
LEFT JOIN course t3
ON t2.c# = t3.c#
LEFT JOIN teacher t4
ON t3.t# = t4.t#
WHERE t4.tname = '李冰冰' --8、查询课程编号“002”的成绩比课程编号“001”课程低的所有同学的学号、姓名;
/* 用单纯的join版 */
/* 用了子查询 */
SELECT a.s#
FROM (SELECT t1.s#,t1.score FROM sc t1 WHERE t1.c# = 111) a
INNER JOIN (SELECT t2.s#,t2.score FROM sc t2 WHERE t2.c# = 112) b
ON a.s# = b.s#
WHERE a.score < b.score --9、查询所有课程成绩小于60分的同学的学号、姓名;
SELECT T1.S#, T1.SNAME
FROM STUDENT T1
INNER JOIN SC T2
ON T1.S# = T2.S#
WHERE T2.C# < 60 --10、查询没有学全所有课的同学的学号、姓名;
/*子查询版*/
SELECT DISTINCT t1.s#,t1.sname
FROM student t1
INNER JOIN SC t2
ON t1.s# = t2.s#
WHERE t2.c# IN (
SELECT t3.c#
FROM Course t3
)
/*exists版*/
SELECT DISTINCT t1.s#,t1.sname
FROM student t1
INNER JOIN SC t2
ON t1.s# = t2.s#
WHERE EXISTS (
SELECT 1
FROM Course t3
WHERE t3.c# = t2.c#
) --11、查询至少有一门课与学号为“1001”的同学所学相同的同学的学号和姓名;
/* 子查询 */
SELECT DISTINCT t1.s#,t1.sname
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
WHERE t2.c# IN (
SELECT t4.c#
FROM student t3
INNER JOIN sc t4
ON t3.s# = t4.s#
WHERE t3.s# = 1
)
/* exists版 */
SELECT DISTINCT t1.s#,t1.sname
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
WHERE EXISTS (
SELECT 1
FROM student t3
INNER JOIN sc t4
ON t3.s# = t4.s#
WHERE t4.c# = t2.c#
AND t3.s# = 1
) --12、查询至少学过学号为“001”同学所有一门课的其他同学学号和姓名;
/* 子查询 */
SELECT DISTINCT t1.s#,t1.sname
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
AND t1.s# <> 1
WHERE t2.c# IN (
SELECT t4.c#
FROM student t3
INNER JOIN sc t4
ON t3.s# = t4.s#
WHERE t3.s# = 1
)
/* exists版 */
SELECT DISTINCT t1.s#,t1.sname
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
AND t1.s# <> 1
WHERE EXISTS (
SELECT 1
FROM student t3
INNER JOIN sc t4
ON t3.s# = t4.s#
WHERE t4.c# = t2.c#
AND t3.s# = 1
) --13、把“SC”表中“叶平”老师教的课的成绩都更改为此课程的平均成绩;
UPDATE sc t4
SET t4.score = (
WITH tmp AS
(
SELECT t1.c#,
AVG(t1.score) AS avg_score
FROM sc t1
INNER JOIN Course t2
ON t1.c# = t2.c#
INNER JOIN teacher t3
ON t2.t# = t3.t#
GROUP BY t1.c#
)
SELECT t5.avg_score
FROM tmp t5
WHERE t4.c# = t5.c#
)
WHERE EXISTS (
SELECT 1
FROM sc t6
INNER JOIN Course t7
ON t6.c# = t7.c#
INNER JOIN teacher t8
ON t7.t# = t8.t#
AND t8.tname = '陈奕迅'
) 14、查询和“1002”号的同学学习的课程完全相同的其他同学学号和姓名;
SELECT DISTINCT t1.s#,
t1.sname
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
AND t2.c# = ALL (
SELECT t4.c#
FROM student t3
INNER JOIN sc t4
ON t3.s# = t4.s#
AND t4.s# = 7
)
AND t1.s# <> 7 --15、删除学习'陈奕迅'老师课的SC表记录;
DELETE FROM sc t1
WHERE EXISTS (
SELECT 1
FROM teacher t2
INNER JOIN Course t3
ON t2.t# = t3.t#
WHERE t3.c# = t1.c#
AND t2.tname = '陈奕迅'
) 16、向SC表中插入一些记录,这些记录要求符合以下条件:没有上过编号“003”课程的同学学号、2号课的平均成绩;
INSERT INTO sc(s#,c#,score) SELECT min(t5.s#),112,AVG(t4.score)
FROM sc t4
INNER JOIN student t5
ON t4.s# = t5.s#
WHERE t4.s# NOT IN (
SELECT t2.s#
FROM student t2
INNER JOIN sc t3
ON t2.s# = t3.s#
AND t3.c# = 113
)
AND t4.c# = 112
GROUP BY t4.c# --17、按平均成绩从高到低显示所有学生的“语文1”、“生物2”、“化学1”三门的课程成绩,按如下形式显示: 学生ID,,数据库,企业管理,英语,有效课程数,有效平均分
/* 行转列除了可以用poivt外还可以分别select出来,再和主表的字段关联 */
SELECT t1.S# as 学生ID,
(SELECT score FROM SC t2 WHERE t2.S#=t1.S# AND t2.C#=111) AS 语文1,
(SELECT score FROM SC t3 WHERE t3.S#=t1.S# AND t3.C#=118) AS 生物2,
(SELECT score FROM SC t4 WHERE t4.S#=t1.S# AND t4.C#=121) AS 化学1,
COUNT(*) AS 有效课程数,
AVG(t1.score) AS 平均成绩
FROM SC t1
GROUP BY t1.S#
ORDER BY avg(t1.score) --18、查询各科成绩最高和最低的分:以如下形式显示:课程ID,最高分,最低分
SELECT t1.c#,
MIN(t1.score) AS min_score,
MAX(t1.score) AS max_score
FROM sc t1
GROUP BY t1.c# --19、按各科平均成绩从低到高和及格率的百分数从高到低顺序
SELECT t1.c#,
AVG(t1.score) AS avg_score,
100 * SUM(
CASE
WHEN nvl(t1.score,0)>=60 THEN
1
ELSE
0
END
)/COUNT(*) AS pass_pct
FROM sc t1
GROUP BY t1.c#
ORDER BY avg_score ASC,pass_pct DESC --20、查询如下课程平均成绩和及格率的百分数(用"1行"显示): 语文1(111),语文2(112),数学1(113),数学2(114)
SELECT SUM(CASE WHEN t1.c# =111 THEN score ELSE 0 END)/SUM(CASE t1.c# WHEN 111 THEN 1 ELSE 0 END) AS 语文1 ,
100 * SUM(CASE WHEN t1.c# = 111 AND score >= 60 THEN 1 ELSE 0 END)/SUM(CASE WHEN t1.c# = 111 THEN 1 ELSE 0 END) AS 语文1及格百分比 ,
SUM(CASE WHEN t1.c# = 112 THEN score ELSE 0 END)/SUM(CASE t1.c# WHEN 112 THEN 1 ELSE 0 END) AS 语文2 ,
100 * SUM(CASE WHEN t1.c# = 112 AND score >= 60 THEN 1 ELSE 0 END)/SUM(CASE WHEN t1.c# = 112 THEN 1 ELSE 0 END) AS 语文2及格百分比 ,
SUM(CASE WHEN t1.c# = 113 THEN score ELSE 0 END)/SUM(CASE t1.c# WHEN 113 THEN 1 ELSE 0 END) AS 数学1 ,
100 * SUM(CASE WHEN t1.c# = 113 AND score >= 60 THEN 1 ELSE 0 END)/SUM(CASE WHEN t1.c# = 113 THEN 1 ELSE 0 END) AS 数学1及格百分比 ,
SUM(CASE WHEN t1.c# = 114 THEN score ELSE 0 END)/SUM(CASE t1.c# WHEN 114 THEN 1 ELSE 0 END) AS 数学2 ,
100 * SUM(CASE WHEN t1.c# = 114 AND score >= 60 THEN 1 ELSE 0 END)/SUM(CASE WHEN t1.c# = 114 THEN 1 ELSE 0 END) AS 数学2及格百分比
FROM SC t1 --21、查询不同老师所教不同课程平均分从高到低显示
SELECT t3.tname,
t2.cname,
AVG(t1.score) AS avg_score
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
INNER JOIN teacher t3
ON t2.t# = t3.t#
GROUP BY t3.tname,t2.cname
ORDER BY avg_score DESC --22、查询如下课程成绩第 3 名到第 6 名的学生成绩单:企业管理(111),马克思(112),UML (113),数据库(114)
SELECT sub_query.cname,
sub_query.rank
FROM(
SELECT t2.cname,
t1.score,
rank() over(PARTITION BY t1.c# ORDER BY t1.score DESC) AS rank
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
WHERE t1.c# IN (111,112,113,114)
) sub_query
WHERE sub_query.rank BETWEEN 3 AND 6; --23、统计列印各科成绩,各分数段人数:课程ID,课程名称,[100-85] 优秀人数,[85-70] 良好人数,[70-60] 一般人数,[ <60] 刚及格人数
SELECT t1.c#,
t2.cname,
SUM(CASE WHEN t1.score > 85 AND t1.score <= 100 THEN 1 ELSE 0 END) AS 优秀人数,
SUM(CASE WHEN t1.score > 70 AND t1.score <= 85 THEN 1 ELSE 0 END) AS 良好人数,
SUM(CASE WHEN t1.score > 60 AND t1.score <= 70 THEN 1 ELSE 0 END) AS 一般人数,
SUM(CASE WHEN t1.score <= 60 THEN 1 ELSE 0 END) AS 刚及格人数
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
GROUP BY t1.c#,t2.cname --24、查询学生平均成绩及其名次
SELECT t1.sname,
t1.s#,
AVG(t2.score) AS avg_score,
dense_rank() over(ORDER BY AVG(t2.score) DESC) AS dense_rank
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
GROUP BY t1.sname,t1.s# --25、查询各科成绩前三名的记录:(不考虑成绩并列情况)
SELECT sub_query.cname,
sub_query.s#,
sub_query.sname,
sub_query.score,
sub_query.rank
FROM (
SELECT t3.cname,
t1.s#,
t1.sname,
t2.score,
rank() over(PARTITION BY t2.c# ORDER BY t2.score DESC) AS rank
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
INNER JOIN course t3
ON t2.c# = t3.c#
) sub_query
WHERE sub_query.rank < 4 --26、查询每门课程被选修的学生数
SELECT t2.cname,
COUNT(t1.s#) AS sum_stu
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
GROUP BY t2.cname --27、查询出只选修了一门课程的全部学生的学号和姓名
/* GROUP BY 语句中选择出来的只有备份组的字段和聚合函数 */
SELECT t1.s#,
t1.sname
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
GROUP BY t1.s#,t1.sname
HAVING COUNT(t2.c#) = 1 --28、查询男生、女生人数
SELECT t1.ssex,
COUNT(t1.ssex) AS sex_num
FROM student t1
GROUP BY t1.ssex --29、查询名字中有'黑'的学生名单
SELECT t1.s#,
t1.sname
FROM student t1
WHERE t1.sname LIKE '%黑%' --30、查询同名同性学生名单,并统计同名人数
/* 写了个错的
原因:student表中有两个小粉,on条件只是县限定了sname相等,所以导致了2X2的笛卡尔乘积*/
SELECT t1.sname,
COUNT(t1.s#) AS same_name_count
FROM student t1
INNER JOIN student t2
ON t1.sname = t2.sname
GROUP BY t1.sname,t2.sname
HAVING COUNT(t1.sname) > 1
/* 正确的写法 */
SELECT t1.sname,
COUNT(t1.sname) AS same_name_count
FROM student t1
GROUP BY t1.sname
HAVING COUNT(t1.sname) > 1 --32、查询每门课程的平均成绩,结果按平均成绩升序排列,平均成绩相同时,按课程号降序排列
SELECT t2.cname,
t2.c#,
AVG(t1.score) AS avg_score
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
GROUP BY t2.cname,t2.c#
ORDER BY avg_score ASC,t2.c# DESC --33、查询平均成绩大于85的所有学生的学号、姓名和平均成绩
SELECT t1.s#,
t1.sname,
AVG(t2.score) AS avg_score
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
GROUP BY t1.s#,t1.sname
HAVING AVG(t2.score) > 85 --34、查询课程名称为'语文1',且分数低于60的学生姓名和分数
SELECT t1.sname,
t2.score
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
INNER JOIN course t3
ON t2.c# = t3.c#
WHERE t3.cname = '语文1'
AND t2.score < 60 --35、查询所有学生的选课情况;
/* 可能不是这样写,有更好的写法 */
SELECT t1.s#,
t1.sname,
t3.cname
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
INNER JOIN course t3
ON t2.c# = t3.c# --36、查询任何一门课程成绩在70分以上的姓名、课程名称和分数;
SELECT t1.s#,
t1.sname,
t3.cname,
t2.score
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
INNER JOIN course t3
ON t2.c# = t3.c#
WHERE t2.score > 70 --37、查询不及格的课程,并按课程号从大到小排列
SELECT t1.c#,
t2.cname,
t1.score
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
WHERE t1.score < 60
ORDER BY t1.c# DESC --38、查询课程编号为003且课程成绩在80分以上的学生的学号和姓名;
SELECT t1.s#,
t1.sname,
t2.score
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
INNER JOIN course t3
ON t2.c# = t3.c#
WHERE t2.c# = 113
AND t2.score > 80 --39、求选了课程的学生人数
SELECT SUM(1)
FROM (
SELECT 1
FROM sc t1
GROUP BY t1.s#
) --40、查询选修“叶平”老师所授课程的学生中,成绩最高的学生姓名及其成绩
SELECT t4.s#,
t4.sname,
t5.score,
t6.cname
FROM student t4
INNER JOIN sc t5
ON t4.s# = t5.s#
INNER JOIN course t6
ON t5.c# = t6.c#
WHERE (t5.score,t6.cname) IN (
SELECT MAX(t1.score),
t2.cname
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
INNER JOIN teacher t3
ON t2.t# = t3.t#
WHERE t3.tname = '陈奕迅'
GROUP BY t2.cname
) --41、查询各个课程及相应的选修人数
SELECT t1.c#,
t2.cname,
COUNT(t1.s#)
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
GROUP BY t1.c#,t2.cname --42、查询不同课程成绩相同的学生的学号、课程号、学生成绩
SELECT t1.s#,
t1.c#,
t1.score
FROM sc t1
INNER JOIN sc t2
ON t1.score = t2.score
AND t1.c# <> t2.c#
AND t1.s# = t2.s# --43、查询每门功成绩最好的前两名
SELECT sub_query.s#,
sub_query.sname,
sub_query.cname,
sub_query.score,
sub_query.rank
FROM (
SELECT t1.s#,
t3.sname,
t2.cname,
t1.score,
dense_rank() over(PARTITION BY t1.c# ORDER BY t1.score DESC) AS rank
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
INNER JOIN student t3
ON t1.s# = t3.s#
) sub_query
WHERE sub_query.rank < 3 --44、统计每门课程的学生选修人数(超过10人的课程才统计)。要求输出课程号和选修人数,查询结果按人数降序排列,查询结果按人数降序排列,若人数相同,按课程号升序排列
SELECT t1.c#,
COUNT(t1.s#) AS stu_num
FROM sc t1
GROUP BY t1.c#
HAVING COUNT(t1.s#) > 10
ORDER BY stu_num DESC,t1.c# ASC --45、检索至少选修两门课程的学生学号
SELECT t1.s#
FROM sc t1
GROUP BY t1.s#
HAVING COUNT(t1.c#) > 1 --46、查询全部学生都选修的课程的课程号和课程名
SELECT t1.c#,
t2.cname,
COUNT(t1.s#)
FROM sc t1
INNER JOIN course t2
ON t1.c# = t2.c#
GROUP BY t1.c#,t2.cname
HAVING COUNT(t1.s#) = (
SELECT COUNT(t3.s#)
FROM student t3
) --47、查询没学过'陈奕迅'老师讲授的任一门课程的学生姓名
SELECT t5.s#,
t5.sname
FROM student t5
WHERE t5.s# NOT IN (
SELECT DISTINCT t1.s#
FROM student t1
INNER JOIN sc t2
ON t1.s# = t2.s#
INNER JOIN course t3
ON t2.c# = t3.c#
INNER JOIN teacher t4
ON t3.t# = t4.t#
WHERE t4.tname = '陈奕迅'
) --48、查询两门以上不及格课程的同学的学号及其平均成绩
/* 不能直接用下面的方式,因为有where条件过滤了一部分的成绩
SELECT t1.s#,
AVG(t1.score)
FROM sc t1
WHERE t1.score < 60
GROUP BY t1.s#
HAVING COUNT(t1.c#) > 2 */
SELECT t2.s#,
AVG(t2.score)
FROM sc t2
WHERE t2.s# IN (
SELECT t1.s#
FROM sc t1
WHERE t1.score < 60
GROUP BY t1.s#
HAVING COUNT(t1.c#) > 2
)
GROUP BY t2.s# --49、检索'114'课程分数小于60,按分数降序排列的同学学号
SELECT t1.s#
FROM sc t1
WHERE t1.c# = 114
AND t1.score < 60
ORDER BY t1.s# DESC --50、删除'2'同学的'111'课程的成绩
DELETE FROM sc t1
WHERE t1.s# = 2
AND t1.c# = 111

面试题 数据库sql的更多相关文章

  1. php开发面试题---数据库SQL调优的几种方式

    php开发面试题---数据库SQL调优的几种方式 一.总结 一句话总结: 创建索引:尽量避免使用or或者like,或者sql中的正则 存储查询中间结果 可以加sphinx搜索技术 查询优化 主从数据库 ...

  2. 面试题: 数据库 sql优化 sql练习题 有用 学生表,课程表,成绩表,教师表 练习

    什么是存储过程?有哪些优缺点? 什么是存储过程?有哪些优缺点? 存储过程就像我们编程语言中的函数一样,封装了我们的代码(PLSQL.T-SQL). 存储过程的优点: 能够将代码封装起来 保存在数据库之 ...

  3. 数据库MySQL经典面试题之SQL语句

    数据库MySQL经典面试题之SQL语句 1.需要数据库表1.学生表Student(SID,Sname,Sage,Ssex) --SID 学生编号,Sname 学生姓名,Sage 出生年月,Ssex 学 ...

  4. 部分常见ORACLE面试题以及SQL注意事项

    部分常见ORACLE面试题以及SQL注意事项 一.表的创建: 一个通过单列外键联系起父表和子表的简单例子如下: CREATE TABLE parent(id INT NOT NULL, PRIMARY ...

  5. 关于数据库SQL优化

    1.数据库访问优化   要正确的优化SQL,我们需要快速定位能性的瓶颈点,也就是说快速找到我们SQL主要的开销在哪里?而大多数情况性能最慢的设备会是瓶颈点,如下载时网络速度可能会是瓶颈点,本地复制文件 ...

  6. Oracle 数据库SQL性能查看

    作为一个开发/测试人员,或多或少都得和数据库打交道,而对数据库的操作归根到底都是SQL语句,所有操作到最后都是操作数据,那么对sql性能的掌控又成了我们工作中一件非常重要的工作.下面简单介绍下一些查看 ...

  7. 你用什么方法检查 PHP 脚本的执行效率(通常是脚本执行时间)和数据库 SQL 的效率(通常是数据库 Query 时间), 并定位和分析脚本执行和数据库查询的瓶颈所在?

    php: 一般是在你要检查的代码开头记录一个时间,结尾记录一个时间.取差值, 数据库SQL的效率    sql的explain(mysql),启用slow query log记录慢查询.   通常还要 ...

  8. 数据库SQL Server与C#中数据类型的对应关系

    ylbtech- .NET-Basic:数据库SQL Server与C#中数据类型的对应关系 数据库SQL SServer与C#中数据类型的对应关系 1.A,返回顶部 数据库 C#程序 int int ...

  9. 我的mysql数据库sql优化原则

    原文 我的mysql数据库sql优化原则 一.前提 这里的原则 只是针对mysql数据库,其他的数据库 某些是殊途同归,某些还是存在差异.我总结的也是mysql普遍的规则,对于某些特殊情况得特殊对待. ...

随机推荐

  1. 2018数学建模国赛总结(A题/编程选手视角)

    2018数学建模已经告一段落了,先说说基本情况吧,我们队伍专业分别为:金融(A),会计(B),计算机(我),配置还算可以,他们俩会数据分析软件也会写论文,我可以写代码,画图.他们俩打过美赛(M奖),我 ...

  2. #论文笔记# [pix2pixHD] High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs

    Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. "High-Res ...

  3. ajax-3验证

    $("#formBtn").click(function () { // var regName =/^[\u4e00-\u9fa5]{2,10}$/;//姓名只能是汉字切2-10 ...

  4. 一个简单的Samba服务

    上次给大家认识了下,搭建一个服务大概的一个认识. 这次给大家搭建一个Samba服务认识下. 项目准备: 虚拟机一个(Centos6.5版本) 项目目标: 进行samba最简单的配置 项目难度: ❤❤ ...

  5. 八大排序算法的python实现(六)归并排序

    代码: #coding:utf-8 #author:徐卜灵 def merge(left,right): i,j = 0,0 result = [] while i < len(left) an ...

  6. JavaWeb学习笔记(十二)—— JDBC的基本使用

    一.JDBC概述 1.1 数据库驱动 这里的驱动的概念和平时听到的那种驱动的概念是一样的,比如平时购买的声卡,网卡直接插到计算机上面是不能用的,必须要安装相应的驱动程序之后才能够使用声卡和网卡,同样道 ...

  7. Android 单选按钮(RadioButton)和复选框(CheckBox)的使用

    1.RadioButton (1)介绍 (2)单选按钮点击事件的用法 (3)RadioButton与RadioGroup配合使用实现单选题功能 (4)xml布局及使用 <?xml version ...

  8. SCU - 4439 最小点覆盖

    题意:求最小的染色顶点数满足所有的边至少有个一端点被染色 2015四川省赛,过题数17/120+,还以为是什么难题,这不就是裸的二分图最小点覆盖吗.. 掏出了尘封一年的破板子 #include< ...

  9. 04-树5 Root of AVL Tree (25 分)

    An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child sub ...

  10. Tomcat SSL证书安装配置

    [From Internet] 首先找到安装Tomcat 目录下该文件“Server.xml”,一般默认路径都是在Conf 文件夹中.然后用文本编辑器打开该文件,接着找到 <Connector ...