Identify the SQL Statements
Test your knowledge of SQL statements including SELECT, INSERT, UPDATE, DELETE, and various clauses like WHERE, ORDER BY, and LIKE.
Questions
What does SQL stand for?
- Structured Question Language
- Strong Question Language
- Structured Query Language
- Structured Query Limited
Which SQL statement is used to extract data from a database?
- FETCH
- GET
- SELECT
- EXTRACT
Which SQL statement is used to update data in a database?
- UPDATE
- MODIFY
- SAVE AS
- SAVE
Which SQL statement is used to delete data from a database?
- REMOVE
- COLLAPSE
- DELETE
- REMOVE ALL
Which SQL statement is used to insert new data in a database?
- ADD NEW
- ADD RECORD
- INSERT NEW
- INSERT INTO
With SQL, how do you select a column named "FirstName" from a table named "Persons"?
- SELECT Persons.FirstName
- EXTRACT FirstName FROM Persons
- SELECT FirstName FROM Persons
- SELECT FROM FirstName IN Persons
With SQL, how do you select all the columns from a table named "Persons"?
- SELECT *.Persons
- SELECT Persons
- SELECT * FROM Persons
- SELECT [all] FROM Persons
With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?
- SELECT * FROM Persons WHERE FirstName='Peter'
- SELECT [all] FROM Persons WHERE FirstName='Peter'
- SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'
- SELECT * FROM Persons WHERE FirstName<>'Peter'
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'
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
- True
- False
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 FirstName='Peter', LastName='Jackson' FROM Persons
- SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
- SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'
- SELECT WHERE FirstName='Peter' AND LastName='Jackson' FROM Persons
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 LastName>'Hansen' AND LastName<'Pettersen' FROM Persons
- SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'
- SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
- SELECT * FROM Persons WHERE LastName IN 'Hansen' AND 'Pettersen'
Which SQL statement is used to return only different values?
- SELECT UNIQUE
- SELECT DISTINCT
- SELECT DIFFERENT
- SELECT SAME
Which SQL keyword is used to sort the result-set?
- SORT
- SORT BY
- ORDER
- ORDER BY
With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
- SELECT * FROM Persons ORDER FirstName DESC
- SELECT * FROM Persons SORT BY 'FirstName' DESC
- SELECT * FROM Persons ORDER BY FirstName DESC
- SELECT * FROM Persons SORT 'FirstName' DESC