MCQs on SQL
MCQs on SQL
MCQ and Quiz about SQL (Structured Query Language) are available.
MCQ and Quiz about SQL (Structured Query Language) are available.
Q No.1 of 10
With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?
Option 1
|
SELECT * FROM Persons WHERE FirstName='Peter'
|
Option 2
|
SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'
|
Option 3
|
SELECT * FROM Persons WHERE FirstName<>'Peter'
|
Option 4
|
SELECT [all] FROM Persons WHERE FirstName='Peter'
|
Q No.2 of 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"?
Option 1
|
SELECT * FROM Persons WHERE FirstName='%a%'
|
Option 2
|
SELECT * FROM Persons WHERE FirstName='a'
|
Option 3
|
SELECT * FROM Persons WHERE FirstName LIKE 'a%'
|
Option 4
|
SELECT * FROM Persons WHERE FirstName LIKE '%a'
|
Q No.3 of 10
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
Option 1
|
True
|
Option 2
|
False
|
Q No.4 of 10
Which SQL statement is used to return only different values?
Option 1
|
SELECT DIFFERENT
|
Option 2
|
SELECT UNIQUE
|
Option 3
|
SELECT DISTINCT
|
Option 4
|
All of these
|
Q No.5 of 10
With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
Option 1
|
SELECT * FROM Persons ORDER FirstName DESC
|
Option 2
|
SELECT * FROM Persons SORT BY 'FirstName' DESC
|
Option 3
|
SELECT * FROM Persons SORT 'FirstName' DESC
|
Option 4
|
SELECT * FROM Persons ORDER BY FirstName DESC
|
Q No.6 of 10
With SQL, how can you insert a new record into the "Persons" table?
Option 1
|
INSERT ('Jimmy', 'Jackson') INTO Persons
|
Option 2
|
INSERT VALUES ('Jimmy', 'Jackson') INTO Persons
|
Option 3
|
INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
|
Option 4
|
Non of these
|
Q No.7 of 10
With SQL, how can you count the number of records in the "Persons" table?
Option 1
|
SELECT COLUMNS() FROM Persons
|
Option 2
|
SELECT COUNT() FROM Persons
|
Option 3
|
SELECT COLUMNS(*) FROM Persons
|
Option 4
|
SELECT COUNT(*) FROM Persons
|
Q No.8 of 10
The result of a SELECT statement can contain duplicate rows.
Option 1
|
True
|
Option 2
|
False
|
Q No.9 of 10
Sometimes the expression "select count(*)" will return fewer rows than the expression "select count(value)".
Option 1
|
False
|
Option 2
|
True
|
Q No.10 of 10
A NULL value is treated as a blank or 0
Option 1
|
False
|
Option 2
|
True
|