0 ratings0% found this document useful (0 votes) 19 views7 pagesDbms Lab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Schema fora University Database
Cre
ea relational eatalave for a iaiver nity desea idee by Hne looong soba ees aur
populate it by tuplen
CLASSROOM (Hailing, Hout Munber, capacity)
DEPARTMENS (Dept name, building, beset)
COURS: (Coun
c ih tthe, Hepp narne, orestits)
INSTRUCTER (1), maine, dept namie, satlinys
SECTION (Course i, ew il, wemnenter, year, oiling, soon nineties she 9)
TEACHES (e119, course id, ee ih memento, Your)
STUDENT (5-1), name, dept naan, tor creat)
TAKES (1D, Coure-id, seit
emester, your, pad)
ADVISOR (5-1), hID)
TIME: SEO (Hin
c-sloteil, day, sat tine, env tite)
PRERIO (Course-id, Preted-id)
[student
2 ——
Theme |
Be a |Exp
iment No
Write the following queties in the SQL. for a Nera
Cup
(1). Increas
above mer
‘Mentioned database of
retrieve, rename) uni
Wwersity
Salary by 20 percent of
all instructors who are working in Dy
ructors along
Jong with their dey
lepartment name
(3). Retrieve names ofall instructors along with their deparmmerr nn
sariment names
|. Retrieve names of all partment (7,
and buildin
which the departments are housed names in
(4), Resieve names of all departments along with names of the b
tee buildings in whieh they are
(5). Change name of the building "Lecture Hall Complex" to “Lecture Th
0 "Lectire Theatre Complex’
(6). Find name of the department of @ student with 1D (Take # valid 10
_- (Take @ valid ID
student) wa
(2). Retrieve names of all instructors along with the Course IDs of the courses they teach
(8). Retrieve Course ID, semester, year and title of each course being, tuwaht by *
‘omputer
Engg." department.
(9). Compure monthly salary of all instructors and display it as ‘monthly salary satibune in
place of attribute ‘salary’
(10), Retrieve names of all departments housed in the building named _ (Consider a
valid Building name)
(11). Find the names of all instructors belonging to Computer Engg. department who have
salary greater than Rs. 70,000.
ve credits 3 and offered by the department IT.
(12). Find titles of the courses that
ad their credits running in semester 4
(13). Find course names
(14), List classes as year and semester wise engaged in room no. LHC-102
(15), List elasses as year, semester and seetion wise engaged in room no, LHC-102
ged in room no. LC-101
(16). List classes as year, semester and section wise enga
(17). Retrieve list of room aumber & time slot where all classes of Computer Semester
7 axe scheduled,
(18). Retrieve Course titles taught by instructor (Take a valid instructor ID or name)
¢, display their names
(19). For all instructors in the university who have taught some cow
along with their department names.
(20), Find the names of all instructors who have a higher salary than some instructor in
“Computer Engg." departmentExperiment No-06
Write the fottowing queries inthe SQI- forthe above mentioned database of a univer
string operation, benween, Aggregate, gtoup by
includes the substring “Tall”
and Rs, $0,000,
(1). Find names of all departments whose building mame
2). Fine) names ofall instructors who have their sabaries between Rs, $0,009
(3). Find names of all students whose names begin with string "Sa"
ag, departanent ane! their names begin
of
(4). Find names of all students belonging to Computer Fi
with character "Sa"
(S)- Retrieve list of courses tought hy teachers whose names begin with cha
(6), Romi
(J). Retrieve list of courses coniaining the word "lang!
1 list of couses beginning. their titles with word "Compute
in their titles.
ww their
(8), Ret < ofthe instructors whe teach courses containing word "lmgag
fe nam
titles.
(0). Find IDs of all students whose names inelude "Kumari® and their department is 11
(10), Find average salary ofall instrmetors,
eg, department.
(UN). Find average salary of the instructors belonging to Computer F:
(12). Find average salary of the instructors belonging (o each department
(13), Find names and average salaries of all depariments whose average salary is greater than
Rs. 60000.
(14). Find total number of courses offered by the university,
3s offered by the Computer Engg department
(15). Find total number of cours
18),
(17), Find total number of instructors who teach a course in the Spring 2016 semester
ind total number of courses taught in the Spring 2016 semester.
(18), Find maximum salary of an insiruetor belonging to Computer Engg, departinent.
Sng, depastment.
(19). Find minimum salary of an instructor belonging t Computer
(20). Find mavimum salary of an instruetor in the university
rolled in the university.
(21). Find total number of student
¢
(23).
22). Find total number of students enrolled in each department of the aaiversty
re greater than Rs, 42,000.
‘ind instructors whose average salaries #
(24), Find instructors whose average salaries are greater than that of the instructors belonging
to the 'Physies’ deparbnent.
(25). Reirieve total no, of students in each department who ceamedd total credits more than 82016, (ave u
or in Spring
J in Spring 2056-6
eration ”
Computer F
ect operation)
gp. depart:
2 216. (use t
Computer Enge
+ along with se operations »
0 6 including keyword “all
+ deparimest in alphabetic oré:
© department in alphabetic order.
5, Listall instructor
g. Listall coursed offered
Making use of sub-queries
1 2015 and in Spring 2016. (s¥
1g 2016. (sub-que
depanment in
9. Find courses taught
10. Find course
1 Fi ,
sub-query. in)
. Computer Enge-
guery, not in)
ave taken courses taught
depastment in Fell 20°
12
nts whe hi
+ ID or name)
fary greater than 1
pat of some (at |
Find nemes of instruc
the Physics deparim:
Implement the followin:
1s query and observe the results
select name
from inst
where sal
y > some (select salary
from instructor
where Dept name ="Physi
Based on the observation
Based onthe abiertiny of theresa wit the qwery i
va inonamany ofthe above query.
nd names ofall he instructors whose salaries
instructors belong eu
setipetea dee fer than that of
‘hysies department. (sub-query, “all”)-_
avand set keyword
17. Using updace statermer
g are preater than 50000" by 15%
psiructors Whose S tsreater than 50000" by
nna. of instructors in cach department
of students in each department.
mgomn’ clause and write query for the Following
Tavies of the instructors of that depart
tors whose salarie:
salaries a7
increase sataries of the instue
decrease salaries of the 3
18, List all departments alone
10, List all departments atone with ne
30, Use a suib-query to derive a elation
vad department names ations, With average S
where average salaries are greater then Rs. 45000"
str no, of students who have eared total cre
Retrieve name of department along W"
more than 7"
h no, of instructors belonging to the department"
"Find name of depertment along, with
I List instructor name, dept name, and no. of courses taught by the instructor in Sprint 2016
Retrieve departments that have budget amount snore than 5 lacs.
nyo have taken at least one course taught by Computes Enj
Find the names of all students WI
department: make sure there are no duplicate names the result
view create, use, drop