Q.1
SELECT dept_name, ID, avg (salary) FROM instructor GROUP BY dept_name; This statement IS erroneous because
  • a) Avg(salary) should not be selected
  • b) Dept_id should not be used in group by clause
  • c) Misplaced group by clause
  • d) Group by clause is not valid in this query
Q.2
SQL applies predicates in the _______ clause after groups have been formed, so aggregate functions may be used.
  • a) Group by
  • b) With
  • c) Where
  • d) Having
Q.3
Aggregate functions can be used in the select list or the_______clause of a select statement or subquery. They cannot be used in a ______ clause.
  • a) Where, having
  • b) Having, where
  • c) Group by, having
  • d) Group by, where
Q.4
The ________ keyword is used to access attributes of preceding tables or subqueries in the from clause.
  • a) In
  • b) Lateral
  • c) Having
  • d) With
Q.5
Which of the following creates a temporary relation for the query on which it is defined?
  • a) With
  • b) From
  • c) Where
  • d) Select
Q.6
WITH max_budget (VALUE) AS (SELECT MAX(budget) FROM department) SELECT budget FROM department, max_budget WHERE department.budget = MAX budget.value;
  • a) Budget
  • b) Department
  • c) Value
  • d) Max_budget
Q.7
Subqueries cannot:
  • a) Use group by or group functions
  • b) Retrieve data from a table different from the one in the outer query
  • c) Join tables
  • d) Appear in select, update, delete, insert statements.
Q.8
Which of the following is not an aggregate function?
  • a) Avg
  • b) Sum
  • c) With
  • d) Min
Q.9
The EXISTS keyword will be true if:
  • a) Any row in the subquery meets the condition only
  • b) All rows in the subquery fail the condition only
  • c) Both of these two conditions are met
  • d) Neither of these two conditions is met
Q.10
How can you find rows that do not match some specified condition?
  • a) EXISTS
  • b) Double use of NOT EXISTS
  • c) NOT EXISTS
  • d) None of the mentioned
0 h : 0 m : 1 s