加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
SQLQuery3.sql 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
shipeig 提交于 2024-05-28 12:31 . 111
select Sno,Sname,Smajor from Student
select Sname,Sbirthdate,Smajor from Student
SELECT Sno
FROM SC
GROUP BY Sno//按学号分组
HAVING COUNT(Cno) >=3
select SUM(Grade)Sum_credit from Student s left join SC on s.Sno='20180001'
select Sno,Sname from Student where Smajor like '%信息系统%'
select Sname from Student where Sname not like '%刘%'
DATEDIFF(year,Sbitthday.GETDATE())
select Sname from Student where DATEDIFF(year,Sbirthdate,GETDATE()) < 20 and Smajor like'计算机'
INSERT INTO Student (Sno, Sname, Ssex, Sbirthdate)
VALUES ('20180009', '李刚', '男', '2001-5-6');
select Sname from Student where DATEDIFF(year,Sbirthdate,GETDATE()) < 20
SELECT COUNT(*) AS TotalStudents
FROM Student
WHERE Sbirthdate >= '2000-01-01';
SELECT COUNT(*) AS TotalStudents
FROM Student
WHERE Sbirthdate >= '2000-01-01';
select * ,DATEDIFF(year,Sbirthdate,GETDATE()) as sage from Student where Sbirthdate >= '2000-01-01';
SELECT Sname
FROM Student
WHERE Sno IN (SELECT Sno FROM Sc WHERE Grade >= 80);
SELECT *
FROM Student
WHERE Sbirthdate >= '2000-01-01' AND Sbirthdate <= '2001-12-31';
SELECT Sname,Ssex
FROM Student
WHERE Smajor <> '信息管理与系统' AND Smajor <> '计算机科学与技术';
SELECT COUNT(*) AS Scount
FROM Student
WHERE DATEDIFF(year,Sbirthdate,GETDATE()) > 20
SELECT *
FROM Student
WHERE Sname LIKE '王__';
update SC set grade=NULL where sno=20180001 and cno=81001
select * from Student s left join SC sc on s.Sno = sc.sno order by Smajor asc,Sbirthdate desc
select Cno,COUNT(1)as hehe from Student s left join SC sc on s.Sno = sc.sno where Cno is not null group by Cno
select AVG(Grade)avg_grade from student s left join SC on s.Sno = SC.Sno where Cno = '81001'
SELECT Cno
FROM Course
GROUP BY Cno;
update [Student] set Sbirthdate = DATEADD(YEAR,1,Sbirthdate) where Ssex = '女'
SELECT MAX(Grade) AS max_grade
FROM Sc
WHERE Cno = 81001;
select distinct Sno from sc
SELECT COUNT(DISTINCT Sno) AS Scount
FROM sc;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化