11. You are working with the Chinook database. You want to find the first and last names of customers who have a value in the country column of either 'Brazil' or 'Argentina'. Replace --??? with the missing information to complete the query. (If you want to undo your changes to the query, you can click the Reset button.)

How many customers are from Brazil or Argentina?

  • 5
  • 6
  • 1
  • 4

12. While working as an analyst, you encounter a query that includes the following filter:

SELECT *

FROM customers

WHERE country = 'USA' AND state = 'NV'

What will this query return?

  • Information about customers who have a value of ‘USA’ in the country column and a value of ‘NV’ in the state column.
  • Information about customers who do not have a value of  ‘USA’ in the country column but do have a value of  ‘NV’ in the state column.
  • Information about customers who have a value of ‘USA’ in the country column or a value of  ‘NV’ in the state column.
  • Information about customers who do not have a value of ‘USA’ in the country column or do not have a value of  ‘NV’ in the state column.

Test your knowledge: SQL joins

13. Which join types return all rows from only one of the tables being joined? Select all that apply.

  • RIGHT JOIN
  • INNER JOIN
  • FULL OUTER JOIN
  • LEFT JOIN

14. You are performing an INNER JOIN on two tables on the employee_id column. The left table is employees, and the right table is machines. Which of the following queries has the correct INNER JOIN syntax?

  • SELECT *

    FROM employees

    INNER JOIN machines WHERE employees.employee_id = machines.employee_id;

  • SELECT *

    FROM employees

    INNER JOIN ON employees.employee_id = machines.employee_id;

  • INNER JOIN machines ON employees.employee_id = machines.employee_id

    SELECT *

    FROM employees;

  • SELECT *

    FROM employees

    INNER JOIN machines ON employees.employee_id = machines.employee_id;

15. In the following query, which join returns all records from the employees table, but only records that match on employee_id from the machines table?

SELECT *

FROM employees

_____ machines ON employees.employee_id = machines.employee_id;

  • FULL OUTER JOIN
  • RIGHT JOIN
  • INNER JOIN
  • LEFT JOIN

16. As a security analyst, you are responsible for performing an INNER JOIN on the invoices and invoice_items tables of the Chinook database. These tables can be connected through the invoiceid column. Replace --??? with the missing information to complete the query. (If you want to undo your changes to the query, you can click the Reset button.)

What is the value in the trackid column of the first row that is returned from this query?

  • 1
  • 3
  • 2
  • 449

Weekly challenge 4

17. Why might a security analyst use SQL?

  • To store data in a spreadsheet
  • To create new files on their computer
  • To efficiently find needed data in security logs
  • To assign new passwords to users

18. Fill in the blank: A column in which every row has a unique entry and which is used to identify a table is called a _____.

  • primary key
  • database key
  • foreign key
  • relational key

Shuffle Q/A 2

19. Which of these SQL statements queries the log_in_attempts table? Select all that apply.

  • SELECT *

    FROM log_in_attempts;

  • SELECT event_id, username

    FROM log_in_attempts

    WHERE event_id < 150;

  • SELECT log_in_attempts

    FROM *;

  • SELECT log_in_attempts

    FROM event_id;

20. What does INNER JOIN do?

  • Combine tables and save them as a new table
  • Compare tables and return only the rows that have a matching value in a specified column
  • Filter databases to return only columns that exist in every table
  • Return every row in joined tables

Leave a Reply