CRUD Operations
5 min read
Module Overview
What You’ll Learn
- Insert data into tables
- Update existing records
- Delete records
- Retrieve inserted data
💡 Why this module matters: A table with no data in it isn’t useful yet. CRUD, Create, Read, Update, Delete, is the full lifecycle of a row, and this module covers the three-quarters of it that aren’t
SELECT: getting data in, changing it, and taking it back out.
What’s Covered
- INSERT, adding a single row to a table.
- INSERT multiple rows, adding several rows in one statement.
- INSERT … SELECT, copying rows from one query straight into a table.
- UPDATE, changing existing rows.
- DELETE, removing rows.
- RETURNING clause, getting back exactly the rows a statement just changed.
Hands-On
By the end of this module, you’ll insert sample records, update selected rows, delete records, and use RETURNING to see exactly what changed, all while building a small employee database of your own.
Next module turns to the tables themselves again, changing their structure after the fact with ALTER TABLE.