DBMS Spring 2021 - Final
DBMS Spring 2021 - Final
1. Write your answers directly on the Blackboard (recommended) or upload word file before
the due date on Blackboard.
2. Write your name and registration ID on the first page of your Word file.
3. Answer scripts can only be uploaded on Blackboard only during the submission time.
4. To avoid any unforeseen problems, you are advised to follow the Guide lines communicated
by the Faculty Members.
5. Submission of answer copy(es) will be considered acceptable through Blackboard only.
Therefore, do not submit your document through email or any other medium.
6. Use 12 pt. font size and Times New Roman font style along with 1-inch page margins.
7. Follow the requirements of the word limit and the marking criteria while writing your
answers.
8. Provide relevant, original and conceptual answers, as this exam aims to test your ability to
examine, explain, modify or develop concepts discussed in class.
9. Do not copy answers from the internet or other sources. The plagiarism of your answers may
be checked through Turnitin.
10. Double check your word file before uploading it on Blackboard to ensure that you have
uploaded the correct file with your answers.
Page 1 of 5
Question # 01 Marks: 10
i. Consider a database with objects A, B, X and Y. Assume that there are two transactions T1
and T2 performing R (read) and W (write) operations before they C (commit).
Given are two example schedules. Identify them as serializable or not serializable. Also
explain with reason(s).
If any of the schedule(s) is identified as not serializable then show with proof that strict
2PL disallows this schedule. [6]
ii. For the value of P = 2 and Q = 2, you are required to provide the solution(final) for the various
schedules:
Also discuss that capacity of A is 90, the outcome obeys the implied consistency rule or not? [4]
Page 2 of 5
Page 3 of 5
Question#2 [10]
1. How would you use the indexes to enforce the constraint that tech_id is a key?
2. Write a query of an update that is definitely speeded up because of the available indexes
3. Give an example of an update that is definitely slowed down because of the indexes
4. Can you give an example of an update that is neither speeded up nor slowed down by the indexes?
ANSWER:
1) Since, it is given in the question that there is a clustered index in tech_id. In order to enforce key
constraint on ‘tech_id’ column, we should declare the ‘tech_id' clustered index as unique and dense. Since the
index is dense, there is atleast one data entry for each each ‘tech_id’ value that appears in the teacher record.
For each ‘tech_id’ there should be exactly one data entry since the index is unique, this can also be enforced
on inserts and updates.
2) Let’s suppose if we want to change the ‘sal’ of all the teachers whose tech_id’s are in a particular range,
then the operation is executed much faster due to the index on ‘tech_id’. In that way we can access the record
much quicker and we wouldn’t have to change any of the indexes.
QUERY: Update Teacher set sal = sal*2.05 where tech_id > 100
3) Example: Index on age column is an uncluttered index. If we were to add 1 to the ages of all the teachers
then we would be slowed down since we would have to update the index on age and an update operation on
an uncluttered index column requires more amount of time and slow down the process.
4) Example: For example, if we were to change the ‘sal’ of those teachers with a particular ‘did’, then there
wouldn’t be any advantage from the given indexes.
Page 4 of 5
101 Tahir M Karachi
1. Write a query to create client table schema in such a way that if we delete row from parent,
its corresponding matching row must be deleted in child table.
2. Write sql query to list all clients who have applied for loan.
3. Write sql query to display details of those clients whose loan status is ‘accepted’.
4. Create a view of client to display client name, address, and bank and loan status.
5. Create a view of client to display loan amount of those clients who belong to Karachi.
6. Create a view so that client can see only HBL bank account details.
7. Create a view to display max amount of loan gender wise.
8. Write a query to give SELECT and DELETE rights on column loan status to Tahir.
9. Write a query to give all rights on column loan status and loan to Tahir and Javeria and
take back rights.
10. Write a query to display all the data from both tables.
Page 5 of 5