How is cohort retention percentage calculated?
Cohort retention is the number of active users from a cohort divided by its original size, multiplied by 100. Count each user at most once per activity month.
Study SQL Cohort Retention and Window Functions with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
How is cohort retention percentage calculated?
Cohort retention is the number of active users from a cohort divided by its original size, multiplied by 100. Count each user at most once per activity month.
What does ROWS BETWEEN 2 PRECEDING AND CURRENT ROW include?
ROWS BETWEEN 2 PRECEDING AND CURRENT ROW includes up to three rows, including the current row. It is not necessarily a three-calendar-month period if months are missing.
How does RANK() handle ties?
RANK() assigns tied rows the same rank and leaves gaps after ties. For example, ranks can go 1, 1, 3.
What does OVER do in a SQL window function?
OVER defines the window used for a calculation across related rows while retaining each row in the result, unlike GROUP BY, which collapses rows.
How does DENSE_RANK() differ from RANK() after a tie?
DENSE_RANK() assigns tied rows the same rank without leaving gaps after ties. For example, ranks can go 1, 1, 2.
What does LAG() access in an ordered partition?
LAG() accesses a previous row in the ordered partition. Subtracting LAG(amount) from the current amount gives the change from the previous row.
How do window ordering and outer ordering differ?
PARTITION BY divides rows into groups for window calculations, and the window ORDER BY sets their calculation sequence. The query’s outer ORDER BY sorts the final output.
How should monthly activity be counted for cohort retention?
Deduplicate activity to one user per activity month before counting active users. This ensures multiple events by one user in that month count only once.
What does filtering ROW_NUMBER() to values at most 3 ensure?
ROW_NUMBER() assigns each row a unique sequence number. Filtering it to values at most 3 returns at most three rows per partition.
Why specify a frame for an ordered rolling aggregate?
An ordered aggregate window’s default frame generally produces a running result through the current row and its peers. Specify a frame deliberately for rolling calculations.
How can a CTE help when filtering window results?
A CTE declared with WITH can organize a multi-step query. An outer query can then filter calculated window results.
How can a retention query include months with zero activity?
A query built from recorded activity returns months with activity. To show zero-activity months, generate cohort-month pairs from a calendar and left join the counts.
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.