ExamGecko
Question list
Search
Search

List of questions

Search

Question 167 - DA0-001 discussion

Report
Export

A data analyst needs to perform a full outer join of a customer's orders using the tables below:

Which of the following is the mean of the order quantity?

A.
73.5
Answers
A.
73.5
B.
76.5
Answers
B.
76.5
C.
78.8
Answers
C.
78.8
D.
81.5
Answers
D.
81.5
Suggested answer: D

Explanation:

The correct answer is D. OUTER JOIN, seven rows.

An OUTER JOIN is a type of SQL join that returns all the rows from both tables, regardless of whether there is a match or not. If there is no match, the missing side will have null values. An OUTER JOIN can be either a LEFT JOIN, a RIGHT JOIN, or a FULL JOIN, depending on which table's rows are preserved1 Using the example tables, a FULL OUTER JOIN query would look like this:

SELECT Cust_id, Order_id, Order_qty FROM Sales_table FULL OUTER JOIN Order_table ON

Sales_table.Order_id = Order_table.Order_id;

The result of this query would be:

Cust_id | Order_id | Order_qty --------±---------±--------- 1 | 1 | 100 2 | 2 | 50 3 | 3 | 25 4 | 4 | 75 NULL | 5 | 10 NULL | 6 | 20 NULL | 7 | 15

As you can see, the query returns seven rows, one for each order in either table. The orders that are not in the Sales_table have null values for the Cust_id column.

To find the mean of the order quantity, we need to sum up the order quantities and divide by the number of rows. In this case, the mean is (100 + 50 + 25 + 75 + 10 + 20 + 15) / 7 = 42.14. Rounding to one decimal place, we get 42.1 as the mean of the order quantity.

asked 02/10/2024
Braden Houser
33 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first