forked from rubyhan1314/Golang-100-Days
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bdff69
commit 6c4cc6d
Showing
51 changed files
with
4,234 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
һ�������� | ||
1.student�� | ||
sno,ѧ�� | ||
sname������ | ||
sex���Ա� | ||
dept��ϵ�� | ||
birth������ | ||
age������ | ||
phoen���绰 | ||
|
||
|
||
2.course�� | ||
cno���γ̱�� | ||
cname������� | ||
credit��ѧ�� | ||
|
||
3.csѡ�α� | ||
sno��ѧ�� | ||
cno���γ̱�� | ||
cj���ɼ� | ||
|
||
������������ | ||
|
||
������ѯ | ||
1.--��ѯ�����Ŀ��Գɼ� | ||
select cno,cj from cs where sno=(select sno from student where sname='���� | ||
'); | ||
2.--��ѯ������ͬѧ�Ŀ��Գɼ� | ||
select * from cs where sno in (select sno from student where sex='��'); | ||
|
||
3.--��ѯ���з�ѧ�ο��Գɼ� | ||
select * from cs where cno=(select cno from course where cname='��ѧ') | ||
|
||
4.--��ѯѡ��java�γ̵�ѧ������ | ||
select sname from student where sno in (select sno from cs where cno=(select cno from course where cname='JAVA')) | ||
|
||
5.--��ѯ����80�ֵ�����ͬѧ��������ϵ�� | ||
select sname,sdept from student where sno in (select sno from cs where | ||
cj<80); | ||
|
||
6.--��ѯѡ��2�ſγ̲��ҿ��Գɼ���90�����ϵ�ѧ��������ѧ�� | ||
select sname,sno from student where sno in (select sno from cs where | ||
cno = 2 and cj > 90); | ||
|
||
7.--��ѯ��'����'��ͬһϵ��ͬѧ��Ϣ | ||
select * from student where sdept=(select sdept from student where | ||
sname ='����'); | ||
|
||
8.--��ѯ����ϵ�бȼ����ϵ����һ��ѧ��������С��ѧ����Ϣ | ||
select * from student where sno in (select sno from student where sdept <> | ||
'�����ϵ' and sage < ALL (select sage from student | ||
where sdept = '�����ϵ')); | ||
|
||
9.--��ѯ��Ϣϵ�б�ƽ������͵�����ѧ����Ϣ | ||
select * from student where sdept ='��Ϣϵ' and | ||
sage < (select avg(sage) from student); | ||
|
||
10.--��ѯû��ѡ��3�ſγ̵�����ѧ�� | ||
select *��from student where sno not in (select sno from cs where cno = 3); | ||
|
||
|
||
|
||
|
||
�𰸣� | ||
1.������ | ||
��һ��student��ѧ���� | ||
CREATE TABLE student(--student | ||
sno NUMBER(4) PRIMARY KEY,--ѧ����� | ||
sname VARCHAR(20) NOT NULL,--ѧ������ | ||
sex VARCHAR(4) CONSTRAINT SEX CHECK (SEX='��' or sex='Ů'),--ѧ���Ա� | ||
dept varchar(20) CONSTRAINT DEPT CHECK(DEPT IN ('��Ϣϵ','�������ѧϵ','��ѧϵ','����ϵ','����ϵ','����ϵ','��ѧϵ')),--ϵ�� | ||
brith date ,--���� | ||
age number(2) CONSTRAINT AGE CHECK (AGE BETWEEN 1 AND 100),--���� | ||
phone NUMBER(11) | ||
) | ||
������course���γ̱� | ||
CREATE TABLE COURSE (--course | ||
cno NUMBER(4) PRIMARY KEY,--�γ̱�� | ||
cname VARCHAR(20) NOT NULL,--����� | ||
credit NUMBER(2)--ѧ�� | ||
credit | ||
) | ||
������cs��ѡ�α� | ||
|
||
|
||
2.�������� | ||
|
||
INSERT INTO STUDENT VALUES (001,'����','��','��Ϣϵ','1-3��-1990',20,'13823451234'); | ||
insert into STUDENT values(002,'����','��','��ѧϵ','15-7��-1994',23,13171254631); | ||
insert into STUDENT values(003,'����','Ů','����ϵ','3-9��-1995',22,15815674123); | ||
insert into STUDENT values(004,'����','��','����ϵ','22-2��-1997',20,13214567125); | ||
insert into STUDENT values(005,'����','��','��ѧϵ','26-8��-1995',22,15012387953); | ||
insert into STUDENT values(006,'����','Ů','�������ѧϵ','26-8��-1995',22,15012567953); | ||
insert into STUDENT values(007,'����','��','�������ѧϵ','26-8��-1995',18,15012567900); | ||
|
||
|
||
INSERT INTO COURSE VALUES(001,'��ѧ',4); | ||
INSERT INTO COURSE VALUES(002,'Ӣ��',2); | ||
INSERT INTO COURSE VALUES(003,'JAVA',3); | ||
INSERT INTO COURSE VALUES(004,'����ѧ',3); | ||
INSERT INTO COURSE VALUES(005,'��ѧ',3); | ||
INSERT INTO COURSE VALUES(006,'SQL',3); | ||
|
||
|
||
INSERT INTO CS VALUES(1,3,87); | ||
INSERT INTO CS VALUES(2,4,67); | ||
INSERT INTO CS VALUES(5,1,66); | ||
INSERT INTO CS VALUES(4,2,95); | ||
INSERT INTO CS VALUES(3,3,58); | ||
INSERT INTO CS VALUES(4,5,90); | ||
INSERT INTO CS VALUES(1,2,90); | ||
|
||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--6.��ѯ���Ų���ACCOUNTING��SALES | ||
--7.��ѯ���ʱ�20�Ų�������һ��Ա�����ߵ�Ա����Ϣ | ||
--8.��ѯ���ʱ�20�Ų�������Ա�����ߵ�Ա����Ϣ | ||
--9.��ѯ�����쵼��Ա�� ��Ϣ | ||
--10.�ҵ�Ա������нˮ���ڱ�����ƽ��нˮ��Ա���� |
Oops, something went wrong.