Module quiz: SQL operators and sorting and filtering data

Module quiz: SQL operators and sorting and filtering data

  1. Which of the following SQL statements adds a $2.00 service fee to the total price in a table called "Orders", that lists the price of orders customers placed with a store?

    • SELECT total + 2 FROM the Orders TABLE;

    • SELECT total + 2 FROM Orders;

    • SELECT total + 2 FROM Orders TABLE;

  2. What does the following SQL statement do?

    SELECT total / 2 FROM Orders;

    • It returns the value of total price column in the second row.

    • It returns the result of total price divided by 2 for each cell in the total price column

  3. The following SQL statement returns 2 percent of the total price:

    SELECT total % 2 FROM Orders;

    • False

    • True

  4. Which of the following SQL statements returns 50% of the total price? Choose all correct answers.

    • SELECT total * 0.5 FROM Orders;

    • SELECT total * 50 FROM Orders;

    • SELECT total / 2 FROM Orders;

    • SELECT total / 50% FROM Orders;

  5. Select the right SQL statement to display the values of the total prices that are greater than $140.

    • SELECT total FROM Orders WHERE total < 140;

    • SELECT total FROM Orders WHERE total >= 140;

    • SELECT total FROM Orders WHERE total > 140;

  6. Does the following SQL statements sort the result-set of the total prices in ascending or descending order?

    SELECT * FROM Orders ORDER BY total;

    • Ascending

    • Descending

  7. The following SQL statement filters data based on ____

    SELECT * FROM customers WHERE Country = "Germany";

    • 'Germany' column with 'country' value

    • 'Country' column with 'Germany' value

  8. In SQL you can sort records in descending order using the DESCENDING keyword.

    • False

    • True

  9. The output of the following SQL query within the Orders table is: UK, UK, UK, France, France, Finland

    SELECT DISTINCT Country FROM Orders;

    • True

    • False

  10. What does the following SQL statement do?

    SELECT * FROM Orders ORDER BY country, total;

    • Orders the result by country and ignores the total price.

    • Orders the result by country first then total price.