Q.(a) Write the outputs of the SQL queries
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Part (a): (i) 200,4300 · (ii) LOGITECH 2, CANON 2 · (iii) MOUSE 3, KEYBOARD 2, JOYSTICK 2 · (iv) four joined rows. Part (b): SHOW DATABASES;.
Part (a)
(i) MIN/MAX scan the PRICE column (200, 4000, 500, 1000, 1200, 4300); the smallest is 200 and the largest 4300.
MIN(PRICE) MAX(PRICE)
200 4300
(ii) Grouping by COMPANY and keeping only groups with more than one row: LOGITECH (MOUSE, KEYBOARD) = 2 and CANON (LASER PRINTER, DESKJET PRINTER) = 2 qualify; IBALL and CREATIVE have only one each.
COMPANY COUNT(*)
LOGITECH 2
CANON 2
(iii) The equi-join on PROD_ID restricted to TYPE='INPUT'. INPUT products are P001, P003, P004, and all three have SALES rows: MOUSE→3, KEYBOARD→2, JOYSTICK→2.
PROD_NAME QTY_SOLD
MOUSE 3
KEYBOARD 2
JOYSTICK 2
(iv) The equi-join over all four SALES rows, one output row per sale, in the SALES order P002, P003, P001, P004.
PROD_NAME COMPANY QUARTER
LASER PRINTER CANON 1
KEYBOARD LOGITECH 2 …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.