ADVERTISEMENT
ADVERTISEMENT

MCQ | SQL – EXCEPT Clause

SQL EXCEPT Clause MCQ: This section contains the Multiple-Choice Questions & Answers on SQL EXCEPT Clause.
Submitted by Anushree Goswami, on October 18, 2021

1. To get a record from one table, which is not present in another table, we can use the clause –

  1. CONCAT
  2. COPY
  3. EXCEPT
  4. ALTER

Answer: C) EXCEPT

Explanation:

To get a record from one table, which is not present in the other table, we can use the clause EXCEPT.


2. SQL EXCEPT statement behaves similar to _____operator in mathematics.

  1. Sum
  2. Multiply
  3. Minus
  4. Divide

Answer: C) Minus

Explanation:

SQL EXCEPT statement behaves similar to Minus operator in mathematics.


3. Select the correct rule of SQL EXCEPT.

  1. There must be the same number of columns in each table and the same order in every select statement.
  2. It is desirable that the columns have similar or compatible data types.
  3. Both SELECT statements must have the same fields in their respective columns.
  4. All of the above

Answer: D) All of the above

Explanation:

Rules of SQL EXCEPT are:

  1. There must be the same number of columns in each table and the same order in every select statement.
  2. It is desirable that the columns have similar or compatible data types.
  3. Both SELECT statements must have the same fields in their respective columns.

4. Select the correct syntax of SQL EXCEPT.

  1. SELECT Column1 FROM Table1
    SELECT Column2 FROM Table2
    EXCEPT;
  2. EXCEPT
    SELECT Column1 FROM Table1
    SELECT Column2 FROM Table2;
  3. SELECT Column1 FROM Table1
    EXCEPT
    SELECT Column2 FROM Table2;
  4. None of the above

Answer: C)

Explanation:

The correct syntax of SQL EXCEPT is,

SELECT Column1 FROM Table1
EXCEPT
SELECT Column2 FROM Table2;

5. SQL EXCEPT clause is supported in –

  1. MySQL
  2. PostgreSQL
  3. Both A and B
  4. None of the above

Answer: B) PostgreSQL

Explanation:

SQL EXCEPT clause is supported in PostgreSQL and not in MySQL.


6. What is TRUE about SQL EXCEPT clause?

  1. The result is purged of duplicates
  2. Duplicate records are not removed
  3. Only one column can be compared by a clause
  4. None of the above

Answer: A) The result is purged of duplicates

Explanation:

In the case of the SQL EXCEPT clause, the result is purged of duplicates.


7. What is TRUE about NOT IN clause?

  1. The result is purged of duplicates
  2. Duplicate records are not removed
  3. Performs column-by-column comparisons
  4. None of the above

Answer: B) Duplicate records are not removed

Explanation:

In the case of the NOT IN clause, Duplicate records are not removed.


8. ORDER BY clause comes ____ the EXCEPT clause in SQL statement?

  1. Before
  2. After
  3. Flexible to before or after
  4. None of the above

Answer: B) After

Explanation:

ORDER BY clauses comes after the EXCEPT clause in SQL statement.


9. SQL EXCEPT returns the record from -

  1. First SELECT Query
  2. Second SELECT Query
  3. Third SELECT Query
  4. None of the above

Answer: A) First SELECT Query

Explanation:

SQL EXCEPT returns the record from the first SELECT Query which is not present in the second SELECT Query.


10. Using which clause, can SQL EXCEPT be used in single table?

  1. TO
  2. AS
  3. WHERE
  4. IN

Answer: C) WHERE

Explanation:

Using WHERE clause, SQL EXCEPT can be used in single table.


ADVERTISEMENT
ADVERTISEMENT


Comments and Discussions!



ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.