SQL MCQs

9 practice MCQs on this page Page 4 of 4

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

Computer ScienceSQL PPSCID: LTP-7786

In Oracle, which function returns the current date and time of the database server?

  1. ATODAY
  2. BNOW
  3. CSYSDATE ✓ Correct answer
  4. DCURDATE
Computer ScienceSQL PPSCID: LTP-7787

In Oracle, the NVL function is used to:

  1. ADelete NULL rows
  2. BCount NULL values
  3. CSort NULL values first
  4. DReplace a NULL value with a given value ✓ Correct answer
Computer ScienceSQL PPSCID: LTP-7788

In Oracle, a sequence is used mainly to:

  1. AGenerate unique numbers automatically ✓ Correct answer
  2. BStore pictures
  3. CPrint reports
  4. DEncrypt data
Computer ScienceSQL PPSCID: LTP-7789

In Oracle, which data type is used for variable-length character strings?

  1. ANUMBER
  2. BVARCHAR2 ✓ Correct answer
  3. CDATE
  4. DCLOB
Computer ScienceSQL PPSCID: LTP-7790

In Oracle, the NUMBER data type is used to store:

  1. APictures only
  2. BDates only
  3. CNumeric values ✓ Correct answer
  4. DLong text only
Computer ScienceSQL PPSCID: LTP-7791

In SQL, which clause joins tables by matching values in a specified column?

  1. AWHERE ONLY
  2. BBY
  3. CWITH
  4. DON ✓ Correct answer
Computer ScienceSQL PPSCID: LTP-7792

In SQL, UNION ALL differs from UNION because UNION ALL:

  1. AKeeps duplicate rows ✓ Correct answer
  2. BRemoves duplicate rows
  3. CDeletes the tables
  4. DSorts in reverse
Computer ScienceSQL PPSCID: LTP-7793

In Oracle, the TO_CHAR function is used to:

  1. ADelete a table
  2. BConvert a date or number to text ✓ Correct answer
  3. CCount rows
  4. DCreate an index
Computer ScienceSQL PPSCID: LTP-7794

In SQL, which statement creates a table with a primary key on the id column?

  1. ASELECT TABLE students (id)
  2. BDROP TABLE students (id)
  3. CCREATE TABLE students (id NUMBER PRIMARY KEY, name VARCHAR2(50)) ✓ Correct answer
  4. DUPDATE TABLE students (id)

Practice these MCQs interactively