Ch 31: SQL Subqueries (Nested & Correlated)

12 Questions12 MCQs0 Short Questions0 Long Questions
๐ŸŽฏ Exam Practice Papers
SEMESTER PASS

CS403 - Database Management Systems Examination Practice

Timed practice exam simulation for CS403 - Database Management Systems.

๐Ÿ“˜ VU MID TERM EXAMLectures 1 to 22
โฑ๏ธ 60 Mins

Mid Term Examination

Covers syllabus of Lectures 1 to 22 with 30 high-yield MCQs in a timed exam environment.

๐Ÿ“30 MCQs
โฑ๏ธ60 Minutes
๐Ÿ“— VU FINAL TERM EXAMLectures 23 to 45
โฑ๏ธ 90 Mins

Final Term Examination

Comprehensive semester exam preparation with 45 MCQs covering Lectures 23 to 45 with complete course coverage.

๐Ÿ“45 MCQs
โฑ๏ธ90 Minutes
Showing 11 โ€“ 12 of 12 Questions
Page 2 of 2
Q11
๐Ÿง  Long Problem๐Ÿ“˜ CS403๐Ÿ“‘ Lec 31๐Ÿท๏ธ 31.2. Equi-Join and Inner JoinHardโญ๐Ÿ’ก๐ŸŒŸ๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Consider the following relational database tables mapped from an e-commerce Entity Relationship Diagram (ERD): - Customer (CusID, CusName, CusAddress) - Order (OrderID, OrderDate, Details, CusID, EmpID) - Bill (BillID, TotalPrice, CusID, OrderID) - DeliveryMan (EmpID, EmpName) Write an SQL query to retrieve the OrderID, OrderDate, CusName, and TotalPrice for all orders placed by the customer named 'Ali Tahir'.
๐Ÿ’ป sql Snippet
SELECT o.OrderID, o.OrderDate, c.CusName, b.TotalPrice
FROM [Order] o
INNER JOIN Customer c ON o.CusID = c.CusID
INNER JOIN Bill b ON o.OrderID = b.OrderID
WHERE c.CusName = 'Ali Tahir';
Q12
๐Ÿง  Long Problem๐Ÿ“˜ CS403๐Ÿ“‘ Lec 31๐Ÿท๏ธ 31.3. Left, Right and Full Outer Joins in SQLHard๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Consider the following Teacher and Class tables in MS SQL Server: Teacher Table: | TeacherID | Name | Office | Phone | Email | |---|---|---|---|---| | T001 | Dr. Najma Waheed | F001 | 9125 | najma@uni.edu.pk | | T002 | Dr. Nouman Masood | F003 | NULL | nayyer@uni.edu.pk | | T003 | Dr. Farhana Khan | F002 | 9222 | farhana@uni.edu.pk | Class Table: | ClassID | CourseCode | DayofWeek | TimeStart | TimeEnd | Venue | TeacherID | |---|---|---|---|---|---|---| | A001 | CS403 | Monday | 09:00 | 10:00 | A Block | T003 | | B002 | CS301 | Tuesday | 09:00 | 10:00 | B Block | T005 | Predict the exact table output of executing the following SQL join query: ```sql SELECT t.TeacherID, t.Name, c.ClassID, c.CourseCode, c.Venue FROM Teacher t LEFT OUTER JOIN Class c ON t.TeacherID = c.TeacherID; ```
๐Ÿ’ป sql Snippet
SELECT t.TeacherID, t.Name, c.ClassID, c.CourseCode, c.Venue
FROM Teacher t
LEFT OUTER JOIN Class c ON t.TeacherID = c.TeacherID;