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.
Questions
1)Which function is used to get the Current System Date and Time
- GetSystemDate()
- GetDate()
- GetCurrentDateTime()
- None
What will be the Output for the Below Query Select * from Retailer where rtrid = (select top 3 Rtrid from retailer)
- Return Top 3 Row in the Retailer Table
- Return Error
- Return No Record
- Return all Records from Retailer Table
Which function is used to get the Current System Date and Time
- GetSystemDate()
- GetDate()
- GetCurrentDateTime()
- None
What will be the Output for the Below Query
- Return Top 3 Row in the Retailer Table
- Return Error
- Return No Record
- Return all Records from Retailer Table
How many Primary Key can be set for an table
- 10
- 1
- 2
- Infinite
What will be the Output for Select Abs(25-45)
- Abs is not a recognized function name
- -20
- 20
- None
Which of the joins are available in SQL i) Inner Join ii) Left Outer Join iii) Cross Join iv) Self Join
- All the Above
- i) and ii)
- i), ii) and iii)
- None
How many Output Parameters can be set for an Stored Procedure
- One
- More than One
- None
- Stored Procedure Does not support Output Parameter
A User Defined Function can Return
- One Value
- More than One Value
- No Value
- User Defined Function will not return Value
A Trigger can be for
- Stored Procedure
- Function
- Table
- View
Which of the following is not a group function?
- Min( )
- Sqrt( )
- Sum( )
- max( )
Which SQL statement is used to extract data from a database?
- Open
- Get
- Extract
- None of the Above
- 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"?
- SELECT * FROM Persons WHERE FirstName='%a%'
- SELECT * FROM Persons WHERE FirstName='a'
- SELECT * FROM Persons WHERE FirstName LIKE '%a'
- SELECT * FROM Persons WHERE FirstName LIKE 'a%'
- With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
- SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'
- SELECT FirstName='Peter', LastName='Jackson' FROM Persons
- SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
- None
- 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"?
- SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'
- SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
- SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons
- None
- Which SQL keyword is used to sort the result-set? SORT BY ORDER BY SORT ORDER
- SORT BY
- ORDER BY
- SORT
- ORDER
- With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
- SELECT * FROM Persons SORT BY 'FirstName' DESC
- SELECT * FROM Persons SORT 'FirstName' DESC
- SELECT * FROM Persons ORDER BY FirstName DESC
- SELECT * FROM Persons ORDER FirstName DES
- With SQL, how can you insert a new record into the "Persons" table?
- INSERT VALUES ('Jimmy', 'Jackson') INTO Persons
- INSERT ('Jimmy', 'Jackson') INTO Persons
- INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
- None
- With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
- INSERT INTO Persons ('Olsen') INTO LastName
- INSERT ('Olsen') INTO Persons (LastName)
- INSERT INTO Persons (LastName) VALUES ('Olsen')
- None
- With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
- DELETE ROW FirstName='Peter' FROM Persons
- DELETE FROM Persons WHERE FirstName = 'Peter'
- DELETE FirstName='Peter' FROM Persons
- None