Database Management Systems, Quiz 1
Consider the following table Sales:
| EmpID | Region | Amount |
|---|---|---|
| 101 | East | 5000 |
| 102 | East | 3000 |
| 103 | West | 7000 |
| 104 | East | 2000 |
| 105 | West | 4000 |
| 106 | North | 3500 |
Table : Sales
SQL Query:
SELECT Region, SUM(Amount) AS TotalSalesFROM SalesWHERE Amount > 3000GROUP BY RegionHAVING SUM(Amount) > 6000;What will be the output of the query?
Consider the following table **Sales**: | EmpID | Region | Amount | |---|---|---| | 101 | East | 5000 | | 102 | East | 3000 | | 103 | West | 7000 | | 104 | East | 2000 | | 105 | West | 4000 | | 106 | North | 3500 | **Table : Sales** **SQL Query:** SELECT Region, SUM(Amount) AS TotalSales FROM Sales WHERE Amount > 3000 GROUP BY Region HAVING SUM(Amount) > 6000; What will be the output of the query? Consider the following SQL statements executed in sequence on a table **students**: CREATE TABLE students ( roll_no INT PRIMARY KEY, name VARCHAR(50), marks INT ); INSERT INTO students VALUES (1, 'Amit', 80); INSERT INTO students VALUES (2, 'Neha', 90); INSERT INTO students VALUES (3, 'Ravi', 70); UPDATE students SET marks = marks + 10 WHERE marks < 85; DELETE FROM students WHERE name = 'Neha'; INSERT INTO students (roll_no, name, marks) VALUES (4, 'Neha', 95); What will be the content of the **students** table after execution? Consider the following relations:\ **auto_part**(<u>*pid*</u>, *pname*, *color*)\ **auto_suppliers**(<u>*sid*</u>, *sname*, *location*)\ **catalog**(<u>*pid*, *sid*</u>, *price*) **TRC** 1. $\{x \mid \exists s \in auto\_suppliers\ \exists c \in catalog\ \exists p \in auto\_part(s.location = \textit{‘Mumbai’} \land c.price = 5000 \land x.sid = c.sid \land x.pname = p.pname \land s.sid = c.sid \land p.pid = c.pid)\}$ 2. $\{x \mid \exists p \in auto\_parts\ \exists c \in catalog(p.pname = \textit{‘Suspension’} \land c.price = 5000 \land x.pid = p.pid \land p.pid = c.pid)\}$ 3. $\{x \mid \exists p \in auto\_parts\ \exists c \in catalog\ \exists s \in auto\_suppliers(p.pname = \textit{‘Suspension’} \land c.price = 5000 \land x.pid = p.pid \land x.sname = s.sname \land p.pid = c.pid \land s.sid = c.sid)\}$ 4. $\{x \mid \exists s \in auto\_suppliers\ \exists c \in catalog(s.location = \textit{‘Mumbai’} \land c.price = 5000 \land x.sid = c.sid \land s.sid = c.sid)\}$ **DRC** a. $\{< m > \mid \exists m, n, o(< m, n, o > \in auto\_parts \land n = \textit{‘Suspension’}) \land \exists a, b, c(< a, b, c > \in catalog \land c = 5000 \land m = a)\}$\ b. $\{< p > \mid \exists p, q, r(< p, q, r > \in auto\_suppliers \land r = \textit{‘Mumbai’}) \land \exists a, b, c(< a, b, c > \in catalog \land c = 5000 \land p = b)\}$\ c. $\{< p > \mid \exists p, q, r(< p, q, r > \in auto\_suppliers \land r = \textit{‘Mumbai’}) \land \exists a, b, c(< a, b, c > \in catalog \land c = 5000)\}$\ d. $\{< m > \mid (< m, n, o > \in auto\_parts \land n = \textit{‘Suspension’}) \land (< a, b, c > \in catalog \land c = 5000 \land m = a)\}$\ e. $\{< p, n > \mid \exists m, n, o(< m, n, o > \in auto\_parts) \land \exists p, q, r(< p, q, r > \in auto\_suppliers \land r = \textit{‘Mumbai’}) \land \exists a, b, c(< a, b, c > \in catalog \land c = 5000 \land m = a \land p = b)\}$\ f. $\{< m, q > \mid \exists m, n, o(< m, n, o > \in auto\_parts \land n = \textit{‘Suspension’}) \land \exists p, q, r(< p, q, r > \in auto\_suppliers) \land \exists a, b, c(< a, b, c > \in catalog \land c = 5000 \land m = a \land p = b)\}$\ g. $\{< p, n > \mid \exists m, n, o(< m, n, o > \in auto\_parts) \land \exists p, q, r(< p, q, r > \in auto\_suppliers \land r = \textit{‘Mumbai’}) \land \exists a, b, c(< a, b, c > \in catalog \land c = 5000)\}$\ h. $\{< m, q > \mid \exists m, n, o(< m, n, o > \in auto\_parts \land n = \textit{‘Suspension’}) \land \exists p, q, r(< p, q, r > \in auto\_suppliers) \land \exists a, b, c(< a, b, c > \in catalog \land c = 5000)\}$ Match the TRC expression to its correct equivalent DRC expression.