Loading topic
UPDATE and DELETE. This chapter reviews how those two statements pick rows and change them. It also shows where a plain WHERE clause stops being enough. The later chapters add UPDATE ... FROM and DELETE ... USING t5 min readSELECT with WHERE and INNER JOIN. It also assumes you know single-table UPDATE and DELETE, and that you understand primary and foreign keys. You can run every statement in psql or any other PostgreSQL client.5 min readcustomers and orders tables from the schema introduced earlier in this tutorial.5 min readUPDATE ... FROM and DELETE ... USING statements from the previous chapters. It covers three things: how aliases work in those statements, which names are visible in each clause, and what SET can and cannot reference. Most of the errors you hit when writing4 min readUPDATE ... FROM and DELETE ... USING statements, and that you know INNER JOIN semantics. Every example uses the customers, orders, products, and price_updates tables from earlier in the tutorial.5 min readUPDATE ... FROM and DELETE ... USING statements and that you know how an inner join multiplies rows. It uses the products and price_updates tables from the schema introduced earlier in this tutorial.5 min readUPDATE ... FROM and DELETE ... USING, and that you know what a subquery is. The examples reuse the customers, orders, products, and price_updates tables from the earlier chapters.6 min readSELECT, WHERE, and INNER JOIN, and that you know single-table UPDATE and DELETE. It also assumes you have seen DELETE ... USING and subqueries in `5 min readUPDATE ... FROM and DELETE ... USING statements and read a basic INNER JOIN. It also assumes you can run statements in psql. The examples use the customers, orders, products, and price_updates tables from earlier in this tutorial.5 min readUPDATE ... FROM and DELETE ... USING statements and know the schema from the earlier chapters (customers, orders, products, price_updates). It also assumes you can run statements in psql or another PostgreSQL client. Here you will build a repeatable r6 min readUPDATE ... FROM and DELETE ... USING, and that you know RETURNING from the previous chapter. It also assumes you know basic WITH queries. It reuses the customers, orders, products, and price_updates tables from the first chapter.5 min readDELETE ... USING and UPDATE ... FROM statements, know why table aliases matter, and can run transactions in psql. It applies those tools to one common job: deleting duplicate rows from a single table while keeping one row per group.5 min readUPDATE ... FROM and DELETE ... USING statements, read a basic EXPLAIN plan, and run statements in psql. It covers what these statements cost on a large table, what they lock, and how to split a big change into safe batches.6 min readUPDATE ... FROM and DELETE ... USING in PostgreSQL, as covered earlier in this tutorial. It also assumes you have used UPDATE ... JOIN in MySQL or UPDATE ... FROM ... JOIN in SQL Server. The goal is to turn statements written for those systems into PostgreS5 min read