Docsity

Sample questions for Query Processing, Quizzes of Database Management Systems (DBMS)

Toggle sidebar
bg1
Sample Questions on Query Processing
Q1: The size of the given NSU student relation is 1000 blocks. The seek time is 10ms and block
transfer time is 0.1 ms. The query is
SELECT * FROM student WHERE id >1801111042
The student relation is physically sorted on id. The number of blocks with id >= 1801111042 is
500.
The height of the primary index on id is 3. Find the estimated cost for the query using the primary
index.
Q2: The NSU student schema is
Student (id, name, CGPA, street, city, year-admit)
The SQL is SELECT * FROM student WHERE CGPA=3 AND City=‘Dhaka’ AND year-
admit=2020
There are B+ tree indices on CGPA, city and year-admit.The heights of the indices are 3, 3 and 2
respectively. The number of tuples (pointers) for CGPA=3, City=‘Dhaka’ and year-admit=2020 are
100, 200 and 1000 respectively. Considering each tuple in separate block, find the least cost of the
SQL using single index. The seek time is 10ms and block transfer time is 0.1 ms.
The result of the intersection of the set of pointers is 20. Find the estimated query cost using the
intersection of pointers.
The height of the composite index on (CGPA, City, year-admit) is 5. The number of pointers
satisfying the query is 20. Find the estimated query cost using the composite index.
Q3: The student and takes schema are: 4
Student (id, name, CGPA, street, city, year-admit)
Takes (id, course-id, semester, year)
The number of records and sizes of student and takes relation are as follows:
Relation No. of records No. of blocks
student 1000 50
takes 5000 10
Find the worst case and best-case cost of natural join operation student ⨝ takes using nested
loop join and block nested loop join.
pf2

Partial preview of the text

Download Sample questions for Query Processing and more Quizzes Database Management Systems (DBMS) in PDF only on Docsity!

Sample Questions on Query Processing Q1: The size of the given NSU student relation is 1000 blocks. The seek time is 10ms and block transfer time is 0.1 ms. The query is SELECT * FROM student WHERE id > The student relation is physically sorted on id. The number of blocks with id >= 1801111042 is

The height of the primary index on id is 3. Find the estimated cost for the query using the primary index. Q2: The NSU student schema is Student (id, name, CGPA, street, city, year-admit) The SQL is SELECT * FROM student WHERE CGPA=3 AND City=‘Dhaka’ AND year- admit= There are B+ tree indices on CGPA, city and year-admit.The heights of the indices are 3, 3 and 2 respectively. The number of tuples (pointers) for CGPA=3, City=‘Dhaka’ and year-admit=2020 are 100, 200 and 1000 respectively. Considering each tuple in separate block, find the least cost of the SQL using single index. The seek time is 10ms and block transfer time is 0.1 ms. The result of the intersection of the set of pointers is 20. Find the estimated query cost using the intersection of pointers. The height of the composite index on (CGPA, City, year-admit) is 5. The number of pointers satisfying the query is 20. Find the estimated query cost using the composite index. Q3: The student and takes schema are: 4 Student (id, name, CGPA, street, city, year-admit) Takes (id, course-id, semester, year) The number of records and sizes of student and takes relation are as follows: Relation No. of records No. of blocks student 1000 50 takes 5000 10 Find the worst case and best-case cost of natural join operation student ⨝ takes using nested loop join and block nested loop join.

Q4: Write relational algebra and construct the execution tree for the following: The relational schema for student course registration are as follows Student (Sid, name, street, city. Mobile, email, CGPA, age) Takes (course-id, Sid, semester, year, GP) Course (course-id, title, credit-hour) (a) SELECT sid, name FROM student inner join takes ON student.sid = takes.sid WHERE city = ‘Dhaka’ AND year = 2023 (b) SELECT sid, name FROM (student inner join takes ON student.sid = takes.sid) inner join course ON takes.course_id = course.course_id WHERE city = ‘Dhaka’ AND year = 2023 AND credit-hour = 3