Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Create Variables and Blocks with Do / Declare in SQL

    postgresPostgreSQL

    Queries can grow in size and become unreadable pretty quickly. Not to mention error-prone if we have to write out the same value multiple times. Just like in almost any other programming language, variables and blocks can be created within SQL. This gives users the ability to write variables at the top of a block and then be referenced through the following transaction.