Loading topic
customers and orders. This chapter explains what each part of that schema does and which rule it enforces. Later chapters rely on those rules: a failed INSERT, a blocked DELETE, or an unexpected default all trace back to a definiti5 min readSELECT ... WHERE query. It also assumes you know what tables, rows, columns, primary keys, and foreign keys are. It uses the customers and orders tables from the schema chapter, repeated here so you can run every example.5 min readINSERT with a column list and that you know the customers and orders tables from the first chapter of this tutorial. Here you will add many rows with one statement, see how that statement succeeds or fails as a unit, and learn the limits that dec6 min readcustomers table from earlier chapters and adds an archive table.5 min readUPDATE changes values in rows that already exist. This chapter covers the statement's structure, how the WHERE clause chooses rows, how NULL and defaults behave in SET, and what happens when a change breaks a constraint.5 min readSET in an UPDATE. You can compute a new value from the row's current values, from other columns, from functions, and from subqueries. The sections below also cover the pitfalls: NULL arithmetic, rounding, and what happens when you assign several columns6 min readDELETE removes whole rows from a table. This chapter assumes you can write a SELECT with a WHERE clause, and that you know what primary keys and foreign keys are. It also assumes you have the customers and orders tables from the first chapter, with customers 1, 2 and 3 inserted. Later chap5 min readSELECT with a WHERE clause and that you know the customers and orders tables from earlier in the tutorial. It also assumes you know what INSERT, UPDATE, and DELETE do in their basic forms. Here you will build a routine that shows which rows a change5 min readcustomers and orders tables from earlier chapters, with their primary keys, foreign key, and defaults. You do not need prior experience with transactions.5 min readINSERT, UPDATE, and DELETE statements and know what primary keys, foreign keys, NOT NULL, UNIQUE, and DEFAULT do. Here you learn to read the error when the database refuses a change, find the row or value responsible, and choose a fix. The example4 min readINSERT, UPDATE, and DELETE statements with a WHERE clause. It also assumes you know what a primary key and a foreign key are, and that you have the customers and `orde5 min readSELECT with JOIN and WHERE, and that you know the customers and orders tables from the start of this tutorial. It also assumes you know about foreign keys and transactions.5 min readDELETE ... WHERE, know what a transaction is, and understand primary keys, foreign keys, and identity (auto-increment) columns at a basic level. It uses the customers and orders tables from earlier in the tutorial. The examples are PostgreSQL unless a note sa6 min readINSERT, UPDATE, and DELETE statements, that you understand primary keys and foreign keys, and that you know what a transaction is. It uses the customers and orders tables from earlier in the tutorial.5 min readINSERT, UPDATE, and DELETE statements, and that you know primary keys and UNIQUE constraints. It uses the customers table from earlier in the tutorial.5 min read