SQL MCQs

20 practice MCQs on this page Page 2 of 4

Tap an option to check your answer — the correct answer and full explanation appear after you choose.

Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-507

Which SQL clause is used to filter rows in a table?

  1. AORDER BY.
  2. BGROUP BY.
  3. CWHERE. ✓ Correct answer
  4. DSELECT.
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-530

Which SQL clause is used to group rows that have the same values?

  1. AORDER BY
  2. BGROUP BY ✓ Correct answer
  3. CSELECT
  4. DFROM
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-553

Which SQL command is used to delete a whole database?

  1. ADELETE DATABASE.
  2. BREMOVE DATABASE.
  3. CDROP DATABASE. ✓ Correct answer
  4. DERASE DATABASE.
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-576

A database administrator wants to delete an entire table, with all its rows and its structure, from a database. Which SQL command does this job?

  1. ADROP TABLE ✓ Correct answer
  2. BDELETE TABLE
  3. CREMOVE TABLE
  4. DERASE TABLE
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-599

Which SQL clause is used to sort the results of a query?

  1. AWHERE.
  2. BGROUP BY.
  3. CHAVING.
  4. DORDER BY. ✓ Correct answer
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-622

Which SQL command is used to save the changes made to a database?

  1. ACOMMIT. ✓ Correct answer
  2. BSAVE.
  3. CSTORE.
  4. DKEEP.
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-645

Which SQL statement is used to change data already stored in a table?

  1. ASELECT.
  2. BINSERT.
  3. CUPDATE. ✓ Correct answer
  4. DDELETE.
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-668

Which SQL keyword is used to sort results in order?

  1. AORDER BY. ✓ Correct answer
  2. BGROUP BY.
  3. CSORT BY.
  4. DFILTER BY.
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-691

Which SQL command is used to add a new column to an existing table?

  1. AUPDATE.
  2. BINSERT.
  3. CCREATE TABLE.
  4. DALTER TABLE. ✓ Correct answer
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-714

Which SQL clause groups rows that share the same values in a column?

  1. AORDER BY
  2. BWHERE
  3. CGROUP BY ✓ Correct answer
  4. DHAVING
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-737

Which SQL keyword removes duplicate rows from the result of a query?

  1. AORDER BY
  2. BUNIQUE
  3. CDISTINCT ✓ Correct answer
  4. DGROUP BY
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-783

Which SQL clause is used to arrange the results in order?

  1. AGROUP BY
  2. BWHERE
  3. CDELETE
  4. DORDER BY ✓ Correct answer
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-806

Which SQL command is used to show the names of all the tables in a database?

  1. ASELECT
  2. BINSERT
  3. CDELETE
  4. DSHOW TABLES ✓ Correct answer
Computer ScienceSQL CSS PPSC FPSC NTSID: CMP-829

In SQL, what does the HAVING clause do?

  1. AIt creates a new table
  2. BIt deletes a whole database
  3. CIt sorts rows in order
  4. DIt filters groups of rows after they are grouped ✓ Correct answer
Computer ScienceSQL PPSCID: PPP-136

Which of the following is NOT a valid keyword in SQL?

  1. ADelete
  2. BInsert
  3. CUpdate
  4. DSubmit ✓ Correct answer
Computer ScienceSQL BPSCID: BPP-916

Which SQL aggregate function ignores NULL values?

  1. AMax()
  2. BSum()
  3. CAvg()
  4. DAll of them ✓ Correct answer
Computer ScienceSQL BPSCID: BPP-2129

The query create index belongs to which of the following

  1. ASQL
  2. BPL/SQL
  3. CDDL ✓ Correct answer
  4. DDML
Computer ScienceSQL BPSCID: BPP-2744

The full form of SQL is:

  1. AStructured Query Language ✓ Correct answer
  2. BStandard Query Language
  3. CSimple Query Language
  4. DSequential Query Language
Computer ScienceSQL BPSCID: BPP-2745

Which SQL command retrieves data from a database?

  1. AINSERT
  2. BSELECT ✓ Correct answer
  3. CUPDATE
  4. DDELETE
Computer ScienceSQL BPSCID: BPP-2746

Which SQL command is used to insert data into a table?

  1. AUPDATE
  2. BCREATE
  3. CINSERT ✓ Correct answer
  4. DSELECT

Practice these MCQs interactively