SQL for Data-Science

SQL for Data-science Coursera Assignment Answers

Week 3 Quiz

1. Which of the following statements is true regarding subqueries?

Answers:

Subqueries always process the innermost query first and the work outward.

2. If you can accomplish the same outcome with a join or a subquery, which one should you always choose?

Answers:

Joins are usually faster, but subqueries can be more reliable, so it depends on your situation.

3. The following diagram is a depiction of what type of join?

Answers:

Inner Join

4. Select which of the following statements are true regarding inner joins. (Select all that apply).

Answers:

Inner joins are one of the most popular types of joins use

There is no limit to the number of table you can join with an inner join.

Performance will most likely worsen with the more joins you make

5. Which of the following is true regarding Aliases?

Answers:

Aliases are often used to make column names more readable.

SQL aliases are used to give a table, or a column in a table, a temporary name.

An alias only exists for the duration of the query.

6. What is wrong with the following query?.

Answers:

Should be using an inner join rather than a left join

Column names do not have an alias

7. What is the difference between a left join and a right join?.

Answers:

The only difference between a left and right join is the order in which the tables are relating.

8. If you perform a cartesian join on a table with 10 rows and a table with 20 rows, how many rows will there be in the output table?

Answers:

200

9. Which of the following statements is true? (select all that apply).

Answers:

Each SELECT statement within UNION must have the same number of columns

The UNION operator is used to combine the result-set of two or more SELECT statements

The columns must also have similar data types

10. Data scientists need to use joins in order to: (select the best answer)

Answers:

Retrieve data from multiple tables.