P S T U: Atuakhali Cience AND Echnology Niversity
P S T U: Atuakhali Cience AND Echnology Niversity
UNIVERSITY
Faculty of Computer Science and Engineering
Assignment 02
Course Title: Database System Sessional
Course Code: CCE-224
Submitted to:
Dr. Md. Samsuzzaman
Professor
Department of Computer and Communication Engineering
Faculty of Computer Science and Engineering
Patuakhali Science and Technology University, Dumki, Patuakhali,
Bangladesh
Submitted by:
Name : Ruhit Shah
ID : 1802055
Reg : 08465
Solving all the queries:
select dept_name
from department
where building like '%Watson%';
select instructor.*
from instructor, teaches
where instructor.ID= teaches.ID;
select name
from instructor
where dept_name = 'Physics'
order by name;
select *
from instructor
order by salary desc, name asc;
select name
from instructor
where salary <= 100000 and salary
>= 90000;
(select course_id
from section
where semester = 'Fall' and year=
2017)
union
(select course_id
from section
where semester = 'Spring' and
year= 2018);
(select course_id
from section
where semester = 'Fall' and year=
2017)
union all
(select course_id
from section
where semester = 'Spring' and
year= 2018);
(select course_id
from section
where semester = 'Fall' and year=
2017)
intersect
(select course_id
from section
where semester = 'Spring' and
year= 2018);
(select course_id
from section
where semester = 'Fall' and year=
2017)
except
(select course_id
from section
where semester = 'Spring' and
year= 2018);
select COUNT(ID)
from teaches
where semester = 'Spring' and
year = 2018;
select count(*)
from course;
select sum(salary)
from instructor;
(select course_id
from section
where semester = 'Spring' and year=
2018)
select distinct course_id
from section
where semester = 'Fall' and year=
2017 and
course_id in (select course_id
from section
where semester = 'Spring' and year=
2018);
select distinct course_id
from section
where semester = 'Fall' and year=
2017 and
course_id not in (select course_id
from section
where semester = 'Spring' and year=
2018);
select dept_name
from instructor
group by dept_name
having avg (salary) >= all (select
avg (salary)
from instructor
group by dept_name);
select course_id
from section as S
where semester = 'Fall' and year=
2017 and
exists (select *
from section as T
where semester = 'Spring' and year=
2018 and
S.course_id= T.course_id);
select T.course_id
from course as T
where 1 >= (select count(R.course_id)
from section as R
where T.course_id= R.course_id and
R.year = 2017);