Tuesday, December 20, 2011

Database Concepts Quiz

1. Which of following represent logical storage of data?
Option :
a. Table
b. View
c. None.
d. Index
Ans: b

2. Which SQL statement is used to extract data from a database?
option:
a. SELECT
b. EXTRACT
c. OPEN
d. GET
Ans: a

3. With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
Options:
a. SELECT * FROM Persons SORT 'FirstName' DESC
b. SELECT * FROM Persons SORT BY 'FirstName' DESC
c. SELECT * FROM Persons ORDER BY FirstName DESC
d. None of the above
e. SELECT * FROM Persons ORDER FirstName DESC

Ans: c

4. With SQL, how can you return the number of records in the "Persons" table?
Options:
a. SELECT COUNT(*) FROM Persons
b. SELECT COLUMNS(*) FROM Persons
c. None of the above
d. SELECT COLUMNS() FROM Persons
e. SELECT COUNT() FROM Persons
Ans : a
5. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
Options:
a. UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'
b. MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'
c. MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen
d. UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'
Ans: d