Informatics Practices
What is the correct statement for describing the EXCEPT operation ?
- It excludes all the rows present in both the queries
- It includes the rows of the second query but excludes the results of the first query
- It includes the rows of the first query but excludes the results of the second query
- It includes all the rows of both queries but removes duplicates
SQL Joins & Grouping
3 Likes
Answer
It includes the rows of the first query but excludes the results of the second query
Reason — The EXCEPT (or MINUS) operator in SQL is used to retrieve unique rows from the first query, specifically those rows that exist in the first query but not in the second query.
Answered By
1 Like
Related Questions
What is the correct statement for describing the UNION operation ?
- It combines the rows of any two different queries
- It combines the unique rows of two different queries which have the same set of attributes in the select clause
- It combines the rows of two different queries which have the same condition in the where clause
- It gives the Cartesian product of the results of any two queries
What is the correct statement for describing the INTERSECT operation?
- It returns the common values from the results of any two different queries
- It returns the common rows of two different queries which have the same set of attributes in the select clause
- It returns the common rows of two different queries which have the same condition in the where clause
- None of these
What is the other name of MINUS operator?
- UNION
- UNION ALL
- EXCEPT
- INTERSECT
Examine the structure of the EMPL and DEPT tables:
Table : EMPL
Column name Data type Remarks EMPLOYEE_ID NUMBER NOT NULL, Primary Key EMP_NAME VARCHAR(30) JOB_ID VARCHAR(20) SALARY NUMBER MGR_ID NUMBER References EMPLOYEE_ID COLUMN DEPARTMENT ID NUMBER Foreign key to DEPARTMENT ID column of the DEPT table Table : DEPT
Column name Data type Remarks DEPARTMENT_ID NUMBER NOT NULL, Primary Key DEPARTMENT_NAME VARCHAR(30) MGR_ID NUMBER References MGR_ID column of the EMPL table Evaluate this SQL statement :
SELECT employee_id, e.department_id, department_ name, salary FROM EMPL e, DEPT d WHERE e.department_id = d.department_id;Which SQL statement is equivalent to the above SQL statement ?
(a)
SELECT employee_id, department_id, department_name, salary FROM EMPL WHERE department_id MATCHES department_id of DEPT;(b)
SELECT employee_id, department_id, department_name,salary FROM EMPL NATURAL JOIN DEPT;(c)
SELECT employee_id, d.department_id, department_name,salary FROM EMPL e JOIN DEPT d ON e.department_id = d.department_id;(d)
SELECT employee_id, department_id, department_name,salary FROM EMPL JOIN DEPT USING (e. department _id, d.department_id);