SQL quiz questions

SQL interview questions

  • 1.

    With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

    1. SELECT * FROM Persons SORT 'FirstName' DESC

    2. SELECT * FROM Persons SORT BY 'FirstName' DESC

    3. SELECT * FROM Persons ORDER FirstName DESC

    4. SELECT * FROM Persons ORDER BY FirstName DESC

    Answer
  • 2.

    Which SQL keyword is used to sort the result-set?

    1. ORDER BY

    2. ORDER

    3. SORT BY

    4. SORT

    Answer
  • 3.

    Which SQL statement is used to return only different values?

    1. SELECT UNIQUE

    2. SELECT DIFFERENT

    3. SELECT DISTINCT

    Answer
  • 4.

    Which SQL statement is used to return only different values?

    1. SELECT UNIQUE

    2. SELECT DIFFERENT

    3. SELECT DISTINCT

    Answer
  • 5.

    With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

    1. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

    2. SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'

    3. SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons

    Answer
  • 6.

    With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

    1. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

    2. SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'

    3. SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons

    Answer
  • 7.

    With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

    1. SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'

    2. SELECT FirstName='Peter', LastName='Jackson' FROM Persons

    3. SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

    Answer
  • 8.

    With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

    1. SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'

    2. SELECT FirstName='Peter', LastName='Jackson' FROM Persons

    3. SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

    Answer
  • 9.

    The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true

    1. True

    2. False

    Answer
  • 10.

    With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

    1. SELECT * FROM Persons WHERE FirstName LIKE 'a%'

    2. SELECT * FROM Persons WHERE FirstName LIKE '%a'

    3. SELECT * FROM Persons WHERE FirstName='%a%'

    4. SELECT * FROM Persons WHERE FirstName='a'

    Answer
  • 11.

    With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

    1. SELECT * FROM Persons WHERE FirstName LIKE 'a%'

    2. SELECT * FROM Persons WHERE FirstName LIKE '%a'

    3. SELECT * FROM Persons WHERE FirstName='%a%'

    4. SELECT * FROM Persons WHERE FirstName='a'

    Answer
  • 12.

    With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

    1. SELECT [all] FROM Persons WHERE FirstName='Peter'

    2. SELECT * FROM Persons WHERE FirstName='Peter'

    3. SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'

    4. SELECT * FROM Persons WHERE FirstName<>'Peter'

    Answer
  • 13.

    With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

    1. SELECT [all] FROM Persons WHERE FirstName='Peter'

    2. SELECT * FROM Persons WHERE FirstName='Peter'

    3. SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'

    4. SELECT * FROM Persons WHERE FirstName<>'Peter'

    Answer
  • 14.

    With SQL, how do you select all the columns from a table named "Persons"?

    1. SELECT Persons

    2. SELECT *.Persons

    3. SELECT [all] FROM Persons

    4. SELECT * FROM Persons

    Answer
  • 15.

    With SQL, how do you select all the columns from a table named "Persons"?

    1. SELECT Persons

    2. SELECT *.Persons

    3. SELECT [all] FROM Persons

    4. SELECT * FROM Persons

    Answer
  • 16.

    With SQL, how do you select a column named "FirstName" from a table named "Persons"?

    1. EXTRACT FirstName FROM Persons

    2. SELECT Persons.FirstName

    3. SELECT FirstName FROM Persons

    Answer
  • 17.

    With SQL, how do you select a column named "FirstName" from a table named "Persons"?

    1. EXTRACT FirstName FROM Persons

    2. SELECT Persons.FirstName

    3. SELECT FirstName FROM Persons

    Answer
  • 18.

    Which SQL statement is used to insert new data in a database?

    1. ADD RECORD

    2. INSERT INTO

    3. INSERT NEW

    4. ADD NEW

    Answer
  • 19.

    Which SQL statement is used to insert new data in a database?

    1. ADD RECORD

    2. INSERT INTO

    3. INSERT NEW

    4. ADD NEW

    Answer
  • 20.

    Which SQL statement is used to delete data from a database?

    1. DELETE

    2. REMOVE

    3. COLLAPSE

    Answer

© 2017 QuizBucket.org