Given the following customer and order tables: Which of the following describes the number of rows and columns of data that would be present after performing an INNER JOIN of the tables?
A. Five rows, eight columns.
Inner join returns only the rows where there is a match between the two tables in the specified join condition. In this case, the join condition would be based on the "Customer ID" column, which is present in both tables. So, the inner join of the two tables would result in 5 rows where there is a match in the "Customer ID" column, and each row would have 8 columns (all columns from both tables).
Table 1 has Customer_IDs: 004, 004, 008, 003, 001, 001, 002
Table 2 has Customer_IDs: 004, 009, 008, 003, 002, 001, 007
Let's count matches:
004 appears twice in Table 1, once in Table 2 = 2 rows in result
008 appears once in each = 1 row
003 appears once in each = 1 row
002 appears once in each = 1 row
001 appears twice in Table 1, once in Table 2 = 2 rows
(009 and 007 only appear in Table 2, so they drop out)
Total number of rows: 2 + 1 + 1 + 1 + 2 = 7 rows
Count columns:
Table 1: Customer_ID, Order_date, Product, Discount_code (4 columns)
Table 2: Customer_ID, Active_flag, Segment, Store_ID, Spend (5 columns)
When joined, Customer_ID appears only once
Total columns: 4 + 5 - 1 = 8 columns
Therefore, the result will have 7 rows and 8 columns.
B is the correct answer. There are 7 rows in the order table, all those 7 rows will retain when inner join occurred because Customer_ID matches the customer table. Since customer like 001 and 004 appear twice in the order table, they will appear twice in the newly joined table as well. There are 8 columns because Customer_ID column is in both tables, 4 unique columns in customer table, 3 unique columns in order table, combined is 8 columns. I tried it with SQL and it returned 7 rows, A is not the answer, joined table can have duplicates.
This section is not available anymore. Please use the main Exam Page.DA0-001 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ronniehaang
Highly Voted 2 years, 2 months agoManizha
Most Recent 5 months, 1 week agoMadalinaUsurelu
6 months, 3 weeks agoSwift_and_Quick
1 year agoHiromi_Nakatani
2 years, 3 months ago