Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
rticle that create Student - Project database with insert, select, update, delete etc...
STUDENT
STUDENT_DOB DATE
STUDENT_DOJ DATE
PROJECT
STUDENT PROJECT
PRIMARYKEY (STUDENT_NO,PRJ_NO,DESIGNATION)
FOREIGN KEY(STUDENT_NO)
FOREIGN KEY(PRJ_NO)
Create student table
(
st_name varchar2(10),
st_dob date,
st_doj date
);
(
prj_name varchar2(15),
prj_dur number(2),
prj_platform varchar2(10)
);
(
designation varchar2(10),
PRIMARY KEY (st_no,prj_no,designation)
);
desc student;
ST_NAME VARCHAR2(10)
ST_DOB DATE
ST_DOJ DATE
desc project;
PRJ_NAME VARCHAR2(15)
PRJ_DUR NUMBER(2)
PRJ_PLATFORM VARCHAR2(10)
desc StudentProject;
Name Null? Type
DESIGNATION VARCHAR2(10)
Insert statements
Output :
ST_NO ST_NAME ST_DOB ST_DOJ
Output :
P01 XYZ 6 VB
Output :
Find number of student who participated in the more than single project.
SELECT distinct st_no AS "STUDENT WHITH MORE PROJECTS " FROM STUdentPROJECT A
WHERE 1 <
(
);
---------------------------
ST1
Find the no of student who did not participated in any of the project
SELECT COUNT(*) AS "STUDENTS NOT CONTAINS PROJECTS" FROM STUDENT WHERE st_no IN
(
NOT IN
);
Output :
------------------------------
1
Output :
ST1 LMN 6
ST1 XYZ 6
ST2 XYZ 6
ST3 ABC 5
ST4 ABC 5
ST5 LMN 6
ST6 LMN 6
group by prj_no;
Output :
P01 2
P02 2
P03 3
group by S.st_no,S.st_name;
Output :
ST1 KRUNAL 2
ST2 BHAVESH 1
ST3 DARSHAN 1
ST4 DHAVAL 1
ST5 BIBIN 1
ST6 SAMIR 1
where st_no IN
(
);
Output :
ST3 DARSHAN 21
Output :
Display the informaton of student who is as programmer and analyst in the same project. (Can use table
Alias)
(
SP2.designation = 'ANALYST'
);
Output :
Display the student who played the max designation(e.g. manager,programmer) in the same project.
HAVING COUNT(designation) =
Output :
ST_ COUNT(DESIGNATION)
ST1 2
ST3 2
Display the info of the project with greater than single no of student involve in it.
SELECT COUNT(st_no),prj_no from StudentProject group by prj_no;
Output :
COUNT(ST_NO) PRJ
3 P01
3 P02
3 P03
Output :
Display the info of the student who works as a prog and as a analyst not for the same project.(can Use
Table alias)
(
SP1.st_no = SP2.st_no
);
Output :
Display the info of the student who works as a programmer and not as an analyst for the same project.
(can Use Table alias)
(
SP1.st_no = SP2.st_no
);
Output :
Display the info of the student who participated in the project where total no of the student should be
exact three.
(
HAVING COUNT(st_no) = 3
Output :
Output :