Monday, March 12, 2012

oDesk SQL Test Answers

1)  What does SQL stand for?

       a) Strong Question Language
       b) Structured Question Language
       c)   Structured Query Language

2) Which SQL statement is used to extract data from a database?
       a) GET
       b) OPEN
       c) EXTRACT
       d)   SELECT
       e) QUERY

3) Which SQL statement is used to update data in a database?

       a)  UPDATE
       b) SAVE AS
       c) MODIFY
       d) SAVE

4) Which SQL statement is used to delete data from a database?

       a)   TRUNCATE
       b) DELETE
       c) REMOVE

5) Which SQL statement is used to insert new data in a database?

       a) ADD RECORD
       b) ADD INTO
       c)  INSERT
       d) ADD NEW

6) With SQL, how do you select a column named "FirstName" from a table named "Persons"?

       a) EXTRACT FirstName FROM Persons
       b)  SELECT FirstName FROM Persons
       c) SELECT Persons.FirstName

7) With SQL, how do you select all the columns from a table named "Persons"?

       a) SELECT [all] FROM Persons
       b) SELECT All Persons
       c) SELECT *.Persons
       d)  SELECT * FROM Persons

8) With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

       a) SELECT [all] FROM Persons WHERE FirstName='Peter'
       b) SELECT * FROM Persons WHERE FirstName LIKE 'Peter'
       c) SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'
       d)SELECT * FROM Persons WHERE FirstName='Peter'

9) 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"?

       a) SELECT * FROM Persons WHERE FirstName='%a%'
       b) SELECT * FROM Persons WHERE FirstName LIKE '%a'
       c) SELECT * FROM Persons WHERE FirstName='a'
       d) SELECT * FROM Persons WHERE FirstName LIKE 'a%'
       e) SELECT * FROM Persons WHERE FirstName='a'"

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

       a) True
       b) False

11) With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
       a) SELECT * FROM Persons WHERE FirstName LIKE 'Peter' AND LastName LIKE 'Jackson'
       b)   SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
       c) SELECT FirstName='Peter', LastName='Jackson' FROM Persons

12) 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"?

       a) SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons
       b) SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
       c) SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'

13) Which SQL statement is used to return only different values?
       a) SELECT UNIQUE
       b) SELECT INDENTITY
       c) SELECT DIFFERENT
       d)  SELECT DISTINCT

14) Which SQL keyword is used to sort the result-set?

       a) SORT BY
       b) ORDER
       c)  ORDER BY
       d) SORT

15) With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

       a) SELECT * FROM Persons SORT BY 'FirstName' DESC
       b) SELECT * FROM Persons ORDER BY FirstName DESC
       c) SELECT * FROM Persons ORDER FirstName DESC
       d) SELECT * FROM Persons SORT 'FirstName' DESC

16) With SQL, how can you insert a new record into the "Persons" table?
       a)  INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
       b) INSERT ('Jimmy', 'Jackson') INTO Persons
       c) INSERT VALUES ('Jimmy', 'Jackson') INTO Persons

17) With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
       a)  INSERT INTO Persons (LastName) VALUES ('Olsen')
       b) INSERT ('Olsen') INTO Persons (LastName)
       c) INSERT INTO Persons ('Olsen') INTO LastName

18) How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
       a) UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'
       b) UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'
       c) MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen
       d) MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'

19) With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
       a)  DELETE FROM Persons WHERE FirstName = 'Peter'
       b) DELETE ROW FirstName='Peter' FROM Persons
       c) DELETE FirstName='Peter' FROM Persons

20) With SQL, how can you return the number of records in the "Persons" table?
       a) SELECT COLUMNS() FROM Persons
       b) SELECT COUNT(*) FROM Persons
       c) SELECT COLUMNS(*) FROM Persons
       d) SELECT COUNT() FROM Persons

21) Given an employees table as follows: empid name managerid a1 bob NULL b1 jim a1 B2 tom a1 What value will select count(*) from employees return?

       a)   1
       b) 2
       c) 3
       d) none of the above

22) The result of a SELECT statement can contain duplicate rows.
       a)  True
       b) False

23) Sometimes the expression "select count(*)" will return fewer rows than the expression "select count(value)".

       a)  True
       b) False

24) What type of lock will deny users any access to a table?
       a) EXPLICIT
       b) IMPLICIT
       c) EXCLUSIVE
       d) SHARED
       e)READ ONLY

25) Which of the following is the correct SQL statement to use to remove rows from a table?

       a) DROP
       b) REMOVE ROW
       c) DELETE
       d) DELETE ROW

26) The only way to join two tables is by using standard, ANSI syntax.

       a) True
       b) False

27) A NULL value is treated as a blank or 0.

       a) True
       b) False

28) The left outer join is one type of outer join. Another one is the.

       a) right
       b) full
       c) right outer
       d) full outer
       e)all of the above

1 comment:


  1. ayam petarung Live di Bangkok yang di tayangkan secara Online hanya di Agen BOLAVITA

    ReplyDelete