A query uses ROWS BETWEEN 6 PRECEDING AND CURRENT ROW. Which statement best describes the frame?
PostgreSQL Window Frames and Rolling Metrics Online Quiz Questions
Use this free practice quiz with 10 questions to review PostgreSQL Window Frames and Rolling Metrics, test your knowledge, and prepare for your next test or exam.
Before calculating daily metrics, how should a system handle timestamps when the reporting day follows a specified local time zone?
- A
Keep all timestamps in UTC and use their UTC dates, regardless of the reporting calendar.
- B
Calculate daily metrics first, then assign each result to a reporting time zone.
- C
Choose the reporting time zone and bucket timestamps into its business dates before calculating daily metrics.
- D
Convert timestamps to dates only after filtering out dates with no activity.
Which approach supports a safe percentage-change calculation comparing each day's revenue with the previous day's revenue?
- A
Use
LEADto retrieve the next day's value, then divide by the current day's revenue. - B
Use
SUMover the same frame, then divide by the number of rows. - C
Use
LAGand divide by the previous value without checking whether it is zero. - D
Use
LAGto retrieve the previous value, expose it in a later query layer, and useNULLIF(previous_day_revenue, 0)as the denominator.
A report needs complete seven-day rolling totals, including zero-activity days. Which preparation best supports the first reported date having a full window?
- A
Aggregate only dates with orders, then begin the calculation at the report start date.
- B
Create a calendar, left join the records, assign zero to missing activity when appropriate, and include enough pre-report dates to fill the first window.
- C
Create dates only after calculating the rolling metric, then add them to the final output.
- D
Replace missing dates with the previous day's revenue and begin the window at the report start date.
Which description of an offset RANGE frame for date or timestamp ordering in PostgreSQL is accurate?
- A
RANGEcounts peer groups, and its offset is a number of physical rows. - B
RANGEcounts physical rows, and its offset is an interval of peer groups. - C
RANGEmeasures distance in the ordering value; a PostgreSQL offset frame for date/time ordering uses an interval and a single ORDER BY expression. - D
RANGEalways includes exactly one row for every calendar date in the interval.
A business's reporting day follows a local time zone rather than UTC. What should happen before daily metrics are calculated?
- A
Bucket timestamps into business dates in the chosen reporting time zone before computing daily metrics.
- B
Always use UTC dates, even when business days follow a different time zone.
- C
Assign timestamps to business dates using the time zone of the database server.
- D
Calculate daily metrics using timestamp values without choosing a reporting time zone.
A complete calendar assigns zero revenue to dates with no orders. What does this mean for a rolling average over those dates?
- A
Missing dates must be removed because a rolling average cannot include them.
- B
Missing dates should always be assigned the previous active day's revenue.
- C
Missing dates should be excluded from every rolling average, without any additional rule.
- D
If missing dates are filled with zero, they are included in the average; averaging only active days requires a separate rule.
What does a SQL window frame using GROUPS count?
- A
GROUPSmeasures a distance in the ordering value. - B
GROUPScounts peer groups rather than individual rows. - C
GROUPSalways counts exactly seven calendar dates. - D
GROUPScounts only rows with unique ordering values.
A percentage-change expression needs the result of LAG. How can the query make that result available for the calculation?
- A
Put both window functions into a single expression so the second can use the first result.
- B
Use
GROUPSinstead ofLAGto return the previous row's value. - C
Calculate
LAGin one query layer and use its result in a later CTE or query layer. - D
Calculate the percentage change before retrieving the previous row's value.
A ROWS frame orders records by date, but several records share each date. What can make a row-by-row calculation's ordering meaningful?
- A
Aggregate to one row per date or add a unique tie-breaker if the calculation is intended to be row-by-row.
- B
Remove the ORDER BY clause so PostgreSQL can choose a consistent row sequence.
- C
Use
RANGEin every case where multiple rows share a date. - D
Sort by the date alone because rows with the same date have a guaranteed unique order.
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.