Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 5 MCQs Introduction to SQL

INT322 — Computing System And Technologies 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Introduction to SQL Easy

    What is SQL mainly used for?

  2. Question 2 of 60 DDL commands Easy

    Which SQL command creates a new table?

  3. Question 3 of 60 DDL commands Easy

    Which DDL command changes the structure of an existing table?

  4. Question 4 of 60 DML commands Easy

    Which SQL command adds a new row to a table?

  5. Question 5 of 60 DML commands Easy

    Which SQL command changes existing data in a table?

  6. Question 6 of 60 DCL commands Easy

    Which DCL command gives a user database privileges?

  7. Question 7 of 60 TCL commands Easy

    Which TCL command permanently saves the changes made in a transaction?

  8. Question 8 of 60 Keys and their types Easy

    Which key uniquely identifies each row in a table?

  9. Question 9 of 60 Keys and their types Easy

    Which key creates a relationship by referring to a key in another table?

  10. Question 10 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Easy

    Which aggregate function returns the smallest value in a column?

  11. Question 11 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Easy

    Which aggregate function calculates the arithmetic mean of numeric values?

  12. Question 12 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Easy

    Which aggregate function returns the number of rows matched by a query?

  13. Question 13 of 60 Self join Easy

    What does a self join do?

  14. Question 14 of 60 Equi join Easy

    Which operator is used in the matching condition of an equi join?

  15. Question 15 of 60 Inner join Easy

    Which rows are returned by an inner join?

  16. Question 16 of 60 Outer join Easy

    What does a left outer join return?

  17. Question 17 of 60 Cross join Easy

    What result does a cross join produce?

  18. Question 18 of 60 GROUP BY clause Easy

    What is the main purpose of the GROUP BY clause?

  19. Question 19 of 60 HAVING clause Easy

    Which clause filters groups after a GROUP BY operation?

  20. Question 20 of 60 ORDER BY clause Easy

    Which clause sorts the rows in a query result?

  21. Question 21 of 60 Introduction to SQL Medium

    A developer writes SELECT name FROM Student WHERE marks >= 75; without specifying how records should be scanned. Which SQL characteristic does this demonstrate?

  22. Question 22 of 60 DDL commands Medium

    A populated Employee table needs a new email column without removing its existing rows. Which command is most appropriate?

  23. Question 23 of 60 DDL commands Medium

    Which statement removes both the TemporaryData table definition and all rows stored in it?

  24. Question 24 of 60 DML commands Medium

    The salary of every employee in department 4 must increase by 10%. Which statement performs the required change?

  25. Question 25 of 60 DCL commands Medium

    User reporter should be allowed to read the Sales table but not modify it. Which command provides the required privilege?

  26. Question 26 of 60 TCL commands Medium

    A transaction creates savepoint before_update, performs two valid inserts, and then performs an incorrect update. Which command undoes only the work after that savepoint?

  27. Question 27 of 60 Keys and their types Medium

    In Enrollment(student_id, course_id, semester), a student may take many courses and a course may have many students. Each student can enroll in a course only once per semester. Which primary key best enforces this rule?

  28. Question 28 of 60 Keys and their types Medium

    The column Order.customer_id references Customer.customer_id. What type of key is Order.customer_id in the Order table?

  29. Question 29 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Medium

    A department has salary values 40000, 50000, and NULL. What does AVG(salary) return for that department?

  30. Question 30 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Medium

    Which query returns the lowest and highest product prices in a single result row?

  31. Question 31 of 60 Self join Medium

    Table Employee(emp_id, name, manager_id) stores each manager's ID in the same table. Which query correctly lists each employee with the employee's manager?

  32. Question 32 of 60 Equi join Medium

    Which condition makes a join between Orders and Customer an equi join?

  33. Question 33 of 60 Inner join Medium

    A query must return only customers who have at least one matching order. Which join should be used between Customer and Orders?

  34. Question 34 of 60 Outer join Medium

    A report must list every customer, including customers who have placed no orders. Which query meets this requirement?

  35. Question 35 of 60 Cross join Medium

    Table Size contains 6 rows and table Color contains 4 rows. How many rows are produced by Size CROSS JOIN Color?

  36. Question 36 of 60 GROUP BY clause Medium

    Which query correctly returns the number of employees in each department?

  37. Question 37 of 60 HAVING clause Medium

    Which query returns only departments whose average salary is greater than 60000?

  38. Question 38 of 60 ORDER BY clause Medium

    A product list must be sorted from highest to lowest price, with equal-priced products sorted alphabetically by name. Which clause is correct?

  39. Question 39 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Medium

    A table contains 5 rows, but bonus is NULL in 2 of them. What values are returned by COUNT(*) and COUNT(bonus)?

  40. Question 40 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Medium

    Which query calculates total sales for each region and retains only regions whose total exceeds 100000?

  41. Question 41 of 60 Introduction to SQL Hard

    Table T(x) contains the rows 1, 2, and NULL. Under standard SQL three-valued logic, which values are returned by SELECT x FROM T WHERE NOT (x = 1);?

  42. Question 42 of 60 DDL commands Hard

    Table Child has a foreign key referencing Parent(id). What happens under standard SQL when DROP TABLE Parent RESTRICT; is executed while that foreign key exists?

  43. Question 43 of 60 DML commands Hard

    Before the following statement, department A has salaries 100, 200, 300, and department B has salaries 50, 150. What is the total salary afterward?

    UPDATE Employee AS e SET salary = salary + 10 WHERE salary < (SELECT AVG(e2.salary) FROM Employee AS e2 WHERE e2.dept = e.dept);

  44. Question 44 of 60 DCL commands Hard

    Alice grants SELECT on R to Bob with the grant option, and Bob grants it to Carol. Alice then executes REVOKE GRANT OPTION FOR SELECT ON R FROM Bob CASCADE;. What is the resulting access?

  45. Question 45 of 60 TCL commands Hard

    Accounts A and B initially contain 500 each. A transaction executes: subtract 100 from A; create savepoint S; add 100 to B; ROLLBACK TO S; then COMMIT. What balances are committed?

  46. Question 46 of 60 Keys and their types Hard

    For relation R(A, B, C, D), the functional dependencies are , , and . Which set lists all candidate keys?

  47. Question 47 of 60 Keys and their types Hard

    Department has primary key dept_id and a UNIQUE NOT NULL column dept_code. Employee.dept_code is nullable. Which constraint declaration is valid under standard relational key rules?

  48. Question 48 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Hard

    Column v contains 10, NULL, 20, and 30. What tuple is produced by SELECT COUNT(*), COUNT(v), SUM(v), AVG(v), MIN(v), MAX(v) FROM T;?

  49. Question 49 of 60 Aggregate functions: MIN, MAX, SUM, AVG and COUNT Hard

    Customer A has two matching orders, while customer B has none. For each customer, a query computes COUNT(*) and COUNT(o.order_id) after a LEFT JOIN to Orders o. What pairs are returned for A and B?

  50. Question 50 of 60 Self join Hard

    Table Employee(id, manager_id) stores a hierarchy. Which query finds employees whose manager's manager has id = 1?

  51. Question 51 of 60 Equi join Hard

    Table A contains join-key values 1, 1, 2, and table B contains 1, 1, 1, 3. How many rows result from A JOIN B ON A.key = B.key?

  52. Question 52 of 60 Inner join Hard

    A contains (k,v) rows (1,10), (2,NULL), (3,20). B contains (1,10), (1,NULL), (2,NULL), (3,30). How many rows result from A JOIN B ON A.k = B.k AND A.v = B.v?

  53. Question 53 of 60 Outer join Hard

    Three employees reference departments 10, 20, and 30. Department 10 is active, department 20 is inactive, and department 30 is absent. What does the following return?

    SELECT COUNT(*), COUNT(d.id) FROM Employee e LEFT JOIN Department d ON e.dept_id = d.id AND d.active = 1;

  54. Question 54 of 60 Outer join Hard

    A contains keys 1, 1, 2, and B contains keys 1, 3, 3. How many rows are produced by A FULL OUTER JOIN B ON A.key = B.key?

  55. Question 55 of 60 Cross join Hard

    A contains x = 1, 2, 3, and B contains y = 2, 3. How many rows remain after SELECT * FROM A CROSS JOIN B WHERE A.x < B.y;?

  56. Question 56 of 60 GROUP BY clause Hard

    Sales rows are ('E','A',10), ('E','A',NULL), ('E','B',20), (NULL,'A',5), and (NULL,'A',15). Ignoring row order, what does SELECT region, product, COUNT(amount), SUM(amount) FROM Sales GROUP BY region, product; return?

  57. Question 57 of 60 GROUP BY clause Hard

    Department A has salaries 10 and 20; department B has salary 100. What is returned by SELECT AVG(dept_avg) FROM (SELECT dept, AVG(salary) AS dept_avg FROM Employee GROUP BY dept) AS D;?

  58. Question 58 of 60 HAVING clause Hard

    Product A has amounts 10, NULL; B has 5, 15; and C has NULL, NULL. Which products survive GROUP BY product HAVING COUNT(amount) = COUNT(*)?

  59. Question 59 of 60 HAVING clause Hard

    Table T contains amounts 10, 20, and NULL. What does SELECT COUNT(*) FROM T HAVING AVG(amount) > 12; return when no GROUP BY is present?

  60. Question 60 of 60 ORDER BY clause Hard

    Which clause selects the three highest-paid employees deterministically, choosing the lower employee_id first whenever salaries tie?

That's unit 5

Answer a few questions and your score shows up here.