How can you find keys that occur more than once?
Group by the key and use HAVING COUNT(*) > 1 to find keys that occur more than once.
Study SQL Joins and Aggregation with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
How can you find keys that occur more than once?
Group by the key and use HAVING COUNT(*) > 1 to find keys that occur more than once.
Where should a right-table filter go to retain unmatched rows in a LEFT JOIN?
Put the right-table condition in ON. The left join can then retain left-side rows with no qualifying match.
How do you prevent two one-to-many child joins from inflating order totals?
Aggregate each child table to one row per order_id, then join those summaries to orders. This prevents item-payment combinations from multiplying order-level measures.
What does the intended grain of a query result specify?
The grain states what one result row represents, such as one row per order. Define it before joining to predict whether matching rows will preserve or multiply rows.
Why does joining child summaries grouped by order_id preserve one row per order?
Each child summary has at most one row per order_id, so joining both summaries to orders preserves one row per order.
What must a join include when related rows are identified by a composite key?
Join on every column in the composite key. Omitting part of it can match unrelated rows.
In a LEFT JOIN, how does COUNT(*) differ from COUNT(o.order_id)?
COUNT(*) counts the preserved left-side row even without a match. COUNT(o.order_id), when order_id is non-nullable, counts matched orders.
What does a LEFT JOIN retain when no right-side row matches?
A LEFT JOIN returns every left-side row and fills right-side columns with NULL when no match exists.
An order has three items and two payments. What can joining both child tables directly produce?
The join can produce six rows: each of three items pairs with each of two payments. Order-level measures may be repeated and overcounted.
What can a WHERE filter on the right table do after a LEFT JOIN?
A WHERE condition on the right table generally removes rows where its value is NULL, excluding left-side rows without a qualifying match.
What do GROUP BY and HAVING do, and what do they not determine?
GROUP BY forms groups; HAVING filters those groups. Neither clause decides whether the chosen grain fits the business question.
Does DISTINCT generally repair inflated aggregates from join multiplication?
No. DISTINCT may hide symptoms or remove legitimate rows; it does not generally correct inflated aggregates caused by row multiplication.
Learn how network security goals, threat modeling, identity and access controls, and layered defenses help protect connected systems and support recovery.
Learn a disciplined workflow for defining network problems, gathering evidence, testing likely causes, applying controlled fixes, and confirming and documenting the results.
A medium-difficulty quiz on networking fundamentals, including communication roles, protocol layers, data units, and network models.
A medium-difficulty quiz on interpreting network protocols, ports, and common traffic patterns.
A medium-difficulty quiz on virtual machine architecture, provisioning, networking, storage, and operations.
A 14-question quiz on applying mobile connectivity concepts to common settings, usage, and troubleshooting situations.
A medium-difficulty quiz on applying and distinguishing IaaS, PaaS, and SaaS, including their responsibilities, trade-offs, and appropriate uses.
Learn to diagnose mobile-device power, battery, touchscreen, connectivity, app, and operating-system problems using safe checks and a systematic process.
A medium-difficulty quiz on network operations, monitoring, configuration management, resilience, and recovery planning.
Learn how security teams monitor activity, manage vulnerabilities, respond to incidents, preserve digital evidence, and restore services safely.
A practical workflow for isolating mixed hardware, display, storage, mobile-device, and network problems, protecting data, and verifying repairs.
A scenario-focused guide to Security+ SY0-701 concepts, emphasizing evidence-based incident response, access control, cryptography, vulnerability handling, recovery objectives, and risk governance.