UPDATE: Conditional and Multi Column Changes
UPDATE changes existing rows. Learn multi column updates, conditional logic with CASE, updates driven by a join and how to check the blast radius firs...
Notes related to SQL.
131 notes tagged
UPDATE changes existing rows. Learn multi column updates, conditional logic with CASE, updates driven by a join and how to check the blast radius firs...
Every way to put rows into a table: explicit column lists, multi row VALUES, INSERT ... SELECT, defaults and handling duplicate keys.
Three ways to remove data, with very different consequences. Learn what each one destroys, what can be rolled back and what resets identity counters.
ALTER changes a table that already holds data. Add and drop columns, change types, set defaults and manage constraints without losing rows.
CREATE defines the objects data lives in. Learn CREATE DATABASE, CREATE SCHEMA and CREATE TABLE, with column definitions and inline constraints.
Two small schemas - a company HR database and a shop sales database - used by every example in this SQL path. Create them once and follow along.
Arithmetic, comparison, logical, string and set operators, how precedence works, and where an expression may legally appear.
Numeric, string, date and boolean types across the major dialects, and how to pick the type that stops bad data at the door.
How a SQL statement is built: clause order, keywords versus identifiers, quoting rules, statement terminators and the two comment styles.
Tables hold typed columns and unordered rows, schemas hold tables, and every value obeys the type its column declares.
SQL is the declarative language used to define and query relational data. Start here to see what a database, a DBMS and an RDBMS actually are.