Urgent.News

What's breaking now, across thousands of outlets.

Tech

5 SQL window-function traps that show up in data engineering interviews (with runnable DuckDB examples)

Window functions are the most common SQL topic in data engineering interviews, and most candidates know the syntax. The follow-up questions are where people stumble. Here are five traps, each with a tiny example you can paste into DuckDB (DuckDB CLI: curl https://install.duckdb.org | sh or brew install duckdb , then run duckdb ; or Python: pip install duckdb , then duckdb.sql("<query>").show() ).…

1. The default frame for window functions in SQL is RANGE, not ROWS. This means that rows with the same order_date are considered peers and included in the frame. To explicitly define the frame, specify the range using ORDER BY and ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.

2. Using ROW_NUMBER() without a tie-breaker can lead to non-deterministic results. If multiple orders have the same date, the order in which they are numbered is not guaranteed. To ensure consistent numbering, include a unique tie-breaker, such as order_id, in the ORDER BY clause.

3. The LAST_VALUE() function returns the current row's amount by default. To obtain the actual last amount, you need to specify the full frame using ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING.

4. The WHERE clause filters rows before window functions are applied. If you want to display data from a specific date range, compute the window function first, then apply the WHERE clause to filter the results. This ensures that all rows are considered before filtering based on the date.

5. When calculating the last 7 rows, using ROWS BETWEEN 6 PRECEDING AND CURRENT ROW counts the rows instead of days. If there are gaps in the data (no orders between Jan 2 and Jan 12), the window may include much older rows. To accurately calculate the last 7 days, use a time-based frame like RANGE BETWEEN INTERVAL 6 DAYS PRECEDING AND CURRENT ROW.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Humanoid Robots in 2026: How Close Are They to Useful Everyday Work?

Originally published on The Daily Flare . Humanoid robots in 2026 are no longer science fiction, but not coworkers yet either.

  • Humanoid robots like Tesla's Optimus and BMW's Figure 02 are piloting in factories and homes.
  • Optimus deployed internally at Tesla, BMW's Figure 02 completed ten-month trial at BMW plant.
  • Unitree G1 and H2 robots priced at $13,500-$16,000, with revenue up 335% to $250 million in 2025.

Create reproducible API support tickets without sharing credentials

When you operate a branded AI API portal, customers need a clear route from a failed request to useful help. A report such as “the API is broken” leaves the next person guessing.

  • Document exact problem occurrence step-by-step
  • Use service name, request path, API base URL
  • Include headers, URLs, bodies sans sensitive data

More from Monday 12 October →