Sample Question CSE311
Sample Question CSE311
of ECE
Sample Questions Final Exam
CSE311 SUM 2024
Q1:
The following relation schemas are given.
Teacher (Tid, name, designation, street, city, Mobile, email, tot_course_money)
Teach (course-id, Tid, semester, year, course-money)
Course (course-id, title, credit-hour)
a. For each course taught by a teacher, a course money is given to him. Write update
statement to update the tot_course_money of all teachers for 2022 and 2023.
b. Write SQL to find Tid, name, semester, year and course title for all teachers of ‘Dhaka’
city and credit hour is 3.
Q2:
The following relation schemas are given.
Student (Sid, name, street, thana, district. Mobile, email, CGPA, age, tot-cred)
Takes (course-id, Sid, semester, year, marks)
Course (course-id, title, credit-hour)
a. Write SQL to find the district, thana wise average marks of all courses with 3 credit-hour
taken by students in 2022 for average marks greater than 90.
b. Write SQL expression to find Sid, name, course-id and title of all students who have taken any
course (course-id) taken by Fatema in Spring 2022.
Q3:
a. Write down any two use of integrity constraint.
b. For the relation
Teacher (Tid, name, designation, street, city, Mobile, email, tot_course_money)
Teach (course-id, Tid, semester, year, course-money)
Create a view T-contact-24 showing all contact information of teachers of ‘Dhaka’ city in year
2024.
Q4:
There are two clerks user c1 and c2 and two managers m1 and m2. There are three roles:
clerk, manager and admin. Clerks can read and insert to person table, manager can read only
and admin can do everything on person table. Implement role based user management and
make m1 as administrator. Change administrator from m1 to m2
Q5:
a. Implement any three types of constraints on the relations below:
Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Takes (Sid, course_id, semester, year, grade)
Q6
Student (Sid, name, street, thana, district. Mobile, email, CGPA, age, tot-cred)
There are some student not taking any course and also some courses not taken by any
student. Write SQL to find all information of students and courses.
Q7:
Q8:
Correct the following SQL
Select name
from instructor
where name = '%dar%'
(select course_id, sec_id from section where sem = ‘Fall’ and year = 2009)
union
(select course_id from section where sem = ‘Spring’ and year = 2010)
select name
from instructor
where salary = null
ABC à DEFGH
So ABC is the primary key. The other functional dependencies are given as follows:
BC àD
ABC à E
EàF
EàG
R(A, B, C, D, E, F, G, H, I)
ABC DEFGHI
B G, B H, D E, D I
Normalize up to 3NF.
User Management
Q5:
There three students users S1, S2 and S3, two teacher users T1 and T2 and one departmental
head (Dr. Sajjad) user.
Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Enroll (course-id, Sid, semester, year, grade)
Course (course-id, title, credit-hour)
Teacher (Tid, name, designation, street, city, Mobile, email, salary, date-of-birth)
Offer (course-id, Tid, semester, year, remuneration)
S1, S2 and S3 can insert and update on student and enroll table, T1 and T2 can insert and update
on teacher and offer table and head can insert, delete and update to all tables.
Q6:
New head is Dr. Rashed. How can you authorize Dr. rashed by
i. Revoking and Granting individual privileges
ii. Revoking and granting role.
Integrity Constraint
Q7:
Given the schema
Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Enroll (course-id, Sid, semester, year, grade)
View
Q8: create a view st-grade-22 with Sid, name, course-id, grade for year 2022
Q9: create a view st-list-22 with Sid, name for year 2022 using the view st-grade-22.
Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Enroll (course-id, Sid, semester, year, grade)
Course (course-id, title, credit-hour)
Teacher (Tid, name, designation, street, city, Mobile, email, salary, date-of-birth)
Offer (course-id, Tid, semester, year, remuneration)
There two student users S1 and S2 and one departmental head user. The relation schema has
been given as follows:
Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Enroll (course-id, Sid, semester, year, grade)
Students S1 and S2 can insert on student and insert and delete on enroll table and head can insert,
delete and update to all tables.
Manage these users by
i. Granting individual privileges
ii. Creating and granting role