Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Basic CTEs
14. Summary


Excellent. It's time to wrap things up.

  • The basic syntax for CTEs in SQL Server is:
    WITH CteName1 (Cte1Columns) AS (
    CteName2 (Cte2Columns) AS (
    SELECT ...
  • CTEs are placed at the start of the query. They are introduced with WITH.
  • You can skip column definitions if you provide aliases for columns containing aggregates and other function results.
  • CTEs are temporary sets of rows similar to subqueries. Thanks to them, your query becomes better organized and easier to read.

Shall we start a very short quiz to check how much you remember?


Click Next exercise to start the short quiz.