Which query pattern identifies keys that occur more than once in a table?
SQL Joins and Aggregation Online Quiz Questions
Use this free practice quiz with 10 questions to review SQL Joins and Aggregation, test your knowledge, and prepare for your next test or exam.
A report must retain every customer, including customers with no orders in a date range, while matching only orders in that range. Which approach fits this requirement?
- A
Use an inner join and put the date condition in WHERE.
- B
Use a left join and put the date condition in WHERE.
- C
Use a left join and put the date condition in ON.
- D
Use a full outer join and put the date condition in WHERE.
One order has three item rows and two payment rows. If both child tables are joined directly to the order, how many joined rows can that order produce?
- A
Six rows, because each item is paired with each payment.
- B
Five rows, because the two child-table counts are added.
- C
Three rows, because the smaller child table limits the result.
- D
One row, because both child tables refer to the same order.
A query needs one row per order with separate item and payment totals. What is the safest way to combine the two one-to-many child tables?
- A
Join both child tables to orders, then use DISTINCT on the final rows.
- B
Join both child tables and group by order_id after summing their measures.
- C
Use an inner join for one child table and a left join for the other.
- D
Aggregate each child table to one row per order_id, then join the summaries to orders.
In query design, what does the intended result grain specify?
- A
The order in which tables are listed in the FROM clause.
- B
What one row in the result represents.
- C
The number of columns returned by the query.
- D
The order in which rows are displayed.
A left join is followed by a WHERE condition requiring a right-table date to be in range. Why can this remove left-table rows with no right-table match?
- A
The WHERE condition filters out rows whose right-side date is NULL.
- B
The WHERE condition converts every unmatched left row into a matching row.
- C
The WHERE condition preserves unmatched left rows because the join is outer.
- D
The WHERE condition changes the left join into a full outer join.
A join multiplies rows and inflates a sum. Which statement best describes using DISTINCT as a proposed general fix?
- A
It guarantees that every child table contributes at most one row per order.
- B
It reverses multiplication before aggregate functions are evaluated.
- C
It is not a general repair for join multiplication and may hide symptoms or remove legitimate rows.
- D
It forces every aggregate to use the intended result grain.
After a left join, which expression should be used to count matching right-side rows when the right-side identifier is non-nullable?
- A
COUNT(*) because it excludes unmatched left-side rows.
- B
COUNT(*) because it counts only non-NULL right-side identifiers.
- C
COUNT(right_table.some_nullable_value) because it always counts each match exactly once.
- D
COUNT(right_table.primary_key) because it counts matched rows when that key is non-nullable.
Which join returns only pairs of rows that match?
- A
A left outer join.
- B
An inner join.
- C
A full outer join.
- D
A cross join.
Why does joining separately aggregated item and payment summaries to orders help preserve one row per order?
- A
Each summary has at most one row per order_id.
- B
Each summary contains exactly one row for every item and payment.
- C
The left joins remove orders without child rows.
- D
The summaries ensure that GROUP BY after the join will undo any multiplication.
Related study packs and tools
1 Network Security Foundations and Threats
Learn how network security goals, threat modeling, identity and access controls, and layered defenses help protect connected systems and support recovery.
1 Network Troubleshooting Method
Learn a disciplined workflow for defining network problems, gathering evidence, testing likely causes, applying controlled fixes, and confirming and documenting the results.
1 Networking Fundamentals
A medium-difficulty quiz on networking fundamentals, including communication roles, protocol layers, data units, and network models.
2 Protocols and Ports
A medium-difficulty quiz on interpreting network protocols, ports, and common traffic patterns.
2 Virtual Machines
A medium-difficulty quiz on virtual machine architecture, provisioning, networking, storage, and operations.
4 Mobile Connectivity
A 14-question quiz on applying mobile connectivity concepts to common settings, usage, and troubleshooting situations.
5 Cloud Service Models
A medium-difficulty quiz on applying and distinguishing IaaS, PaaS, and SaaS, including their responsibilities, trade-offs, and appropriate uses.
5 Diagnosing Mobile Device Problems
Learn to diagnose mobile-device power, battery, touchscreen, connectivity, app, and operating-system problems using safe checks and a systematic process.
5 Network Operations and Reliability
A medium-difficulty quiz on network operations, monitoring, configuration management, resilience, and recovery planning.
6 Security Operations and Incident Response
Learn how security teams monitor activity, manage vulnerabilities, respond to incidents, preserve digital evidence, and restore services safely.
7 Integrated Troubleshooting Practice
A practical workflow for isolating mixed hardware, display, storage, mobile-device, and network problems, protecting data, and verifying repairs.
8 Comprehensive Security+ Practice and Review
A scenario-focused guide to Security+ SY0-701 concepts, emphasizing evidence-based incident response, access control, cryptography, vulnerability handling, recovery objectives, and risk governance.