4. Basic Data Retrieval – Test Yourself

Please find the answers at the end of the test.

Q1. What does it mean SQL is NOT case sensitive?

  1. You can only enter SQL statements in uppercase 
  2. You can enter SQL statements in either lowercase or uppercase 
  3. It allows you to enter SQL in case format
  4. The SQL is not sensitive to white spaces

Q2. How are white spaces handled in an SQL statement?

  1. They are only tolerated if you write a query on one line
  2. If they are uniformly written, SQL executes them without problems
  3. Extra white spaces in SQL statements are ignored when executing the statements
  4. They are only handled if SQL is written over several lines

Q3. What is used to terminate an SQL statement?

  1. :
  2. @
  3. !
  4. ;

Q4. Which of the following can be used to comment out SQL code?

  1. – – (double hyphen)
  2. /:   :/
  3. ==
  4. /*    */

Q5. What is a keyword in SQL?

  1. They cannot be used as table names, column names or values
  2. They are reserved words that are used to form part of the SQL language
  3. They are used for naming tables
  4. They can only be used in SELECT statements

Q6. What keyword is used to produce a table?

  1. UPDATE
  2. CREATE
  3. INSERT
  4. PRODUCE

Q7. What keyword is used to create rows in a table?

  1. CREATE
  2. UPDATE
  3. INSERT
  4. INVERT

Q8. What is a SELECT statement?

  1. It allows the retrieval of data from a table(s)
  2. It allows tables to be maintained
  3. It allows a database to be maintained
  4. It allows data to be updated

Q9. Which of the following queries are correct?

  1. SELECT ALL FROM account;
  2. SELECT trans_id FROM account;
  3. SELECT * FROM account;
  4. SELECT FROM account;

Q10. What can follow the word SELECT in a SELECT statement?

  1. A list of columns that are to be retrieved
  2. The FROM clause
  3. The tables to be used
  4. An asterisk (*)

Q11. What does * mean in a SELECT statement?

  1. It is a wildcard to aid the WHERE clause
  2. It allows a search to be filtered
  3. It is a wildcard, where all columns of a table will be retrieved
  4. It is used to retrieve all rows in a table

Q12. How do you select specific columns in a SELECT statement?

  1. By specifying which columns are required in the WHERE clause
  2. By coding the actual column names required after the SELECT keyword
  3. By coding the columns required in the FROM clause
  4. By coding the columns required after the wildcard 

Q13. What clause is used to sort retrieved data in a SELECT statement?

  1. SORT BY
  2. ORGANISE BY
  3. SORTED BY
  4. ORDER BY

Q14. What keyword is used to sort data upwards?

  1. DESC
  2. ASC 
  3. UP
  4. DOWN

Q15. What keyword is used to sort data downwards?

  1. DOWNWARDS
  2. DESCENDING
  3. DESC
  4. TOPDOWN

Q16. What function is used in a SELECT statement to return only unique values in a column?

  1. DISTINCT
  2. UNIQUE
  3. PRIMARY
  4. NON_DUPLICATE

Q17. What clause is used to filter data in a SELECT statement?

  1. CREATE
  2. FROM
  3. WHERE
  4. UNION

Q18. Which of the following shows correct WHERE clause operators?

  1. =, <>, <, >, <=, >=
  2. TOGETHER, LIKE, GREATER, LESS
  3. BETWEEN, LIKE, IN
  4. <>, !=, INBETWEEN, SIMILAR

Q19. Which of the following are correct?

  1. SELECT * FROM account WHERE payee = The Big Shop;
  2. SELECT * FROM account WHERE expense > ‘99.99’;
  3. SELECT * FROM account WHERE income <> 9.99;
  4. SELECT * FROM account WHERE account_name LIKE %Shop;

Q20. What is a VARCHAR?

  1. A data type that that holds text of a fixed length
  2. A variable string operator
  3. A variable length string data type
  4. A data type that holds variable date formats

Q21. What does INT stand for?

  1. Decimal number
  2. Integer
  3. Number
  4. Integrated

Q22. Which operators can the WHERE clause be combined with to filter data?

  1. ORDER BY
  2. OR
  3. AND
  4. SORT BY

Q23. What is the best and cleaner way of separating AND and OR statements in an SQL query to ensure they execute properly?

  1. Using a semicolon
  2. Using parentheses
  3. Using quotes
  4. Using comments

Q24. What is a NULL value in a database cell?

  1. Zero
  2. Less than zero
  3. An empty cell
  4. An error

Q25. What operator do we use to find certain text in a column?

  1. IN
  2. LIKE
  3. BETWEEN
  4. SIMILAR

Q26. What character do we use for a wildcard search when using LIKE?

  1. @
  2. ;
  3. *
  4. %

Q27. Which of the following will return a payee that “starts” with “market”?

  1. WHERE payee LIKE ‘%market‘;
  2. WHERE payee LIKE ‘market%’;
  3. WHERE payee LIKE ‘%market%’;
  4. WHERE payee LIKE ‘mar%ket‘;

ANSWERS:

Q1. What does it mean SQL is NOT case sensitive?

  1. You can only enter SQL statements in uppercase  
  2. You can enter SQL statements in either lowercase or uppercase 
  3. It allows you to enter SQL in a case format
  4. The SQL is not sensitive to white spaces

Answer:

2

Q2. How are white spaces handled in an SQL statement?

  1. They are only tolerated if you write a query on one line
  2. If they are uniformly written, SQL executes them without problems
  3. Extra white spaces in SQL statements are ignored when executing the statements
  4. They are only handled if SQL is written over several lines

Answer:

3

Q3. What is used to terminate an SQL statement?

  1. :
  2. @
  3. !
  4. ;

Answer:

4

Q4. Which of the following can be used to comment out SQL code?

  1. – – (double hyphen)
  2. /:   :/
  3. ==
  4. /*    */

Answer:

1 and 4

Q5. What is a keyword in SQL?

  1. They cannot be used as table names, column names or values
  2. They are reserved words that are used to form part of the SQL language
  3. They are used for naming tables
  4. They can only be used in SELECT statements

Answer:

1 and 2

Q6. What keyword is used to produce a table?

  1. UPDATE
  2. CREATE
  3. INSERT
  4. PRODUCE

Answer:

2

Q7. What keyword is used to create rows in a table?

  1. CREATE
  2. UPDATE
  3. INSERT
  4. INVERT

Answer:

3

Q8. What is a SELECT statement?

  1. It allows the retrieval of data from a table(s)
  2. It allows tables to be maintained
  3. It allows a database to be maintained
  4. It allows data to be updated

Answer:

1

Q9. Which of the following queries are correct?

  1. SELECT ALL FROM account;
  2. SELECT trans_id FROM account;
  3. SELECT * FROM account;
  4. SELECT FROM account;

Answer:

2 and 3

Q10. What can follow the word SELECT in a SELECT statement?

  1. A list of columns that are to be retrieved
  2. The FROM clause
  3. The tables to be used
  4. An asterisk (*)

Answer:

1 and 4

Q11. What does * mean in a SELECT statement?

  1. It is a wildcard to aid the WHERE clause
  2. It allows a search to be filtered
  3. It is a wildcard, where all columns of a table will be retrieved
  4. It is used to retrieve all rows in a table

Answer:

3

Q12. How do you select specific columns in a SELECT statement?

  1. By specifying which columns are required in the WHERE clause
  2. By coding the actual column names required after the SELECT keyword
  3. By coding the columns required in the FROM clause
  4. By coding the columns required after the wildcard 

Answer:

2

Q13. What clause is used to sort retrieved data in a SELECT statement?

  1. SORT BY
  2. ORGANISE BY
  3. SORTED BY
  4. ORDER BY

Answer:

4

Q14. What keyword is used to sort data upwards?

  1. DESC
  2. ASC 
  3. UP
  4. DOWN

Answer:

2

Q15. What keyword is used to sort data downwards?

  1. DOWNWARDS
  2. DESCENDING
  3. DESC
  4. TOPDOWN

Answer:

3

Q16. What function is used in a SELECT statement to return only unique values in a column?

  1. DISTINCT
  2. UNIQUE
  3. PRIMARY
  4. NON_DUPLICATE

Answer:

1

Q17. What clause is used to filter data in a SELECT statement?

  1. CREATE
  2. FROM
  3. WHERE
  4. UNION

Answer:

3

Q18. Which of the following shows correct WHERE clause operators?

  1. =, <>, <, >, <=, >=
  2. TOGETHER, LIKE, GREATER, LESS
  3. BETWEEN, LIKE, IN
  4. <>, !=, INBETWEEN, SIMILAR

Answer:

1 and 3

Q19. Which of the following are correct?

  1. SELECT * FROM account WHERE payee = The Big Shop;
  2. SELECT * FROM account WHERE expense > ‘99.99’;
  3. SELECT * FROM account WHERE income <> 9.99;
  4. SELECT * FROM account WHERE account_name LIKE %Shop;

Answer:

3

Number 1: The Big Shop should be in quotes

Number 2: expense is likely to be a DECIMAL, therefore, no quotes are required

Number 4: %Shop should be i quotes

Q20. What is a VARCHAR?

  1. A data type that that holds text of a fixed length
  2. A variable string operator
  3. A variable length string data type
  4. A data type that holds variable date formats

Answer:

3

Q21. What does INT stand for?

  1. Decimal number
  2. Integer
  3. Number
  4. Integrated

Answer:

2

Q22. Which operators can the WHERE clause be combined with to filter data?

  1. ORDER BY
  2. OR
  3. AND
  4. SORT BY

Answer:

2 and 4

Number 1: ORDER BY cannot filter data it can only put returned data in a certain order

Number 4: There is no keyword SORT BY

Q23. What is the best and cleaner way of separating AND and OR statements in an SQL query to ensure they execute properly?

  1. Using a semicolon
  2. Using parentheses
  3. Using quotes
  4. Using comments

Answer:

2

Q24. What is a NULL value in a database cell?

  1. Zero
  2. Less than zero
  3. An empty cell
  4. An error

Answer:

3

Q25. What operator do we use to find a snippet of text in a column?

  1. IN
  2. LIKE
  3. BETWEEN
  4. SIMILAR

Answer:

2

Q26. What character do we use for a wildcard search when using LIKE?

  1. @
  2. ;
  3. *
  4. %

Answer:

4

Q27. Which of the following will return a payee that “starts” with market?

  1. WHERE payee LIKE ‘%market‘;
  2. WHERE payee LIKE ‘market%’;
  3. WHERE payee LIKE ‘%market%’;
  4. WHERE payee LIKE ‘mar%ket‘;

Answer:

2 and 3

Return To Lesson ⇒ 4. Basic Data Retrieval