SQL Fundamentals Quiz

Test your knowledge of SQL basics including SELECT, INSERT, DELETE, WHERE clauses, ORDER BY, aggregate functions, joins, stored procedures, triggers, and database functions.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

1)Which function is used to get the Current System Date and Time

  1. GetSystemDate()
  2. GetDate()
  3. GetCurrentDateTime()
  4. None
Question 2 Multiple Choice (Single Answer)

What will be the Output for the Below Query Select * from Retailer where rtrid = (select top 3 Rtrid from retailer)

  1. Return Top 3 Row in the Retailer Table
  2. Return Error
  3. Return No Record
  4. Return all Records from Retailer Table
Question 3 Multiple Choice (Single Answer)

Which function is used to get the Current System Date and Time

  1. GetSystemDate()
  2. GetDate()
  3. GetCurrentDateTime()
  4. None
Question 4 Multiple Choice (Single Answer)

What will be the Output for the Below Query

  1. Return Top 3 Row in the Retailer Table
  2. Return Error
  3. Return No Record
  4. Return all Records from Retailer Table
Question 5 Multiple Choice (Single Answer)

How many Primary Key can be set for an table

  1. 10
  2. 1
  3. 2
  4. Infinite
Question 6 Multiple Choice (Single Answer)

What will be the Output for Select Abs(25-45)

  1. Abs is not a recognized function name
  2. -20
  3. 20
  4. None
Question 7 Multiple Choice (Single Answer)

Which of the joins are available in SQL i) Inner Join ii) Left Outer Join iii) Cross Join iv) Self Join

  1. All the Above
  2. i) and ii)
  3. i), ii) and iii)
  4. None
Question 8 Multiple Choice (Single Answer)

How many Output Parameters can be set for an Stored Procedure

  1. One
  2. More than One
  3. None
  4. Stored Procedure Does not support Output Parameter
Question 9 Multiple Choice (Single Answer)

A User Defined Function can Return

  1. One Value
  2. More than One Value
  3. No Value
  4. User Defined Function will not return Value
Question 10 Multiple Choice (Single Answer)

A Trigger can be for

  1. Stored Procedure
  2. Function
  3. Table
  4. View
Question 11 Multiple Choice (Single Answer)

Which of the following is not a group function?

  1. Min( )
  2. Sqrt( )
  3. Sum( )
  4. max( )
Question 12 Multiple Choice (Single Answer)

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

  1. Open
  2. Get
  3. Extract
  4. None of the Above
Question 13 Multiple Choice (Single Answer)
  1. 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='%a%'
  2. SELECT * FROM Persons WHERE FirstName='a'
  3. SELECT * FROM Persons WHERE FirstName LIKE '%a'
  4. SELECT * FROM Persons WHERE FirstName LIKE 'a%'
Question 14 Multiple Choice (Single Answer)
  1. 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'
  4. None
Question 15 Multiple Choice (Single Answer)
  1. 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>'Hansen' AND LastName<'Pettersen'
  2. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
  3. SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons
  4. None
Question 16 Multiple Choice (Single Answer)
  1. Which SQL keyword is used to sort the result-set? SORT BY ORDER BY SORT ORDER
  1. SORT BY
  2. ORDER BY
  3. SORT
  4. ORDER
Question 17 Multiple Choice (Single Answer)
  1. With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
  1. SELECT * FROM Persons SORT BY 'FirstName' DESC
  2. SELECT * FROM Persons SORT 'FirstName' DESC
  3. SELECT * FROM Persons ORDER BY FirstName DESC
  4. SELECT * FROM Persons ORDER FirstName DES
Question 18 Multiple Choice (Single Answer)
  1. With SQL, how can you insert a new record into the "Persons" table?
  1. INSERT VALUES ('Jimmy', 'Jackson') INTO Persons
  2. INSERT ('Jimmy', 'Jackson') INTO Persons
  3. INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
  4. None
Question 19 Multiple Choice (Single Answer)
  1. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
  1. INSERT INTO Persons ('Olsen') INTO LastName
  2. INSERT ('Olsen') INTO Persons (LastName)
  3. INSERT INTO Persons (LastName) VALUES ('Olsen')
  4. None
Question 20 Multiple Choice (Single Answer)
  1. With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
  1. DELETE ROW FirstName='Peter' FROM Persons
  2. DELETE FROM Persons WHERE FirstName = 'Peter'
  3. DELETE FirstName='Peter' FROM Persons
  4. None