Solve “Deduplicate events with ROW_NUMBER”

Free. Runs in your browser, no install.

SQL · Keys, Schema & CTEs

What is a CTE?

Easyctewithreadability

Interview question

What is a CTE?

How to answer

The short answer

= Common Table Expression.

SQL
WITH high_salary AS (
    SELECT *
    FROM employees
    WHERE salary > 100000
)
SELECT *
FROM high_salary;

It makes complex SQL easier to read and can also support recursive queries.

Lock it in with a real drill

You remember an answer longer once you have used it. Try a hands-on problem on this concept.

Open related drill