Junior Track Roadmap

Raw SQL: select & from

This course introduces SQL through SELECT and FROM in PostgreSQL. It explains relational tables, rows, columns and primary keys, and how a query moves from parser to planner to executor. Lessons cover SELECT as an expression evaluator, reading tables with FROM, choosing columns instead of SELECT *, aliases with AS, CASE expressions and NULL behavior with COALESCE and NULLIF. The last lesson connects these ideas to ActiveRecord, showing the SQL behind select, pluck and find_by_sql and how to read it in the Rails log.

What you'll learn

  • ✓How relational databases store data in tables, rows and columns
  • ✓Using SELECT with literals, arithmetic, string concatenation and built-in functions
  • ✓Reading tables with FROM and selecting only the columns you need
  • ✓Naming results with AS aliases and building CASE expressions
  • ✓How NULL behaves in comparisons, expressions and aggregates
  • ✓How ActiveRecord methods translate to SELECT and FROM queries
Free preview · Lesson 1 7 min read

What is SQL?

Imagine a massive library with millions of books, but no librarian. The books are organized on shelves by category, author, and year. You can't just shout "give me something good!" You need to write a precise request on a slip of paper: which shelf, which section, which criteria. The library reads…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...