Loading topic
SELECT, INSERT, UPDATE, and DELETE statements. It also assumes you have a PostgreSQL 12 or newer instance and a client such as psql. Constraints and keys get their own chapters. Here the focus is on what each column stores and why.5 min readSELECT, INSERT, UPDATE, and DELETE statements. It also assumes you have PostgreSQL 12 or newer and can run SQL in psql or another client. The tables are the ones the earlier chapters sketched: authors, books, and the join table book_authors.5 min readSELECT, INSERT, and UPDATE statements, and that you have PostgreSQL 12 or newer and a psql session open. It also assumes you have created the authors, books, and readings tables from the earlier chapters. The definitions are repeated here where 5 min readauthors, `boo5 min readbooks and authors. It assumes you have created the authors and books tables from the earlier chapters, and that you know primary keys, foreign keys, and `ON D5 min readreadings table, which records your history with each book. It assumes you have the books and authors tables from earlier chapters, and that you know CHECK constraints and foreign keys at a basic level. The aim is to make the database refuse impossible histories, such 5 min readauthors, books, book_authors, and readings, with the identity keys and constraints defined there. You should also be comfortable with a basic INSERT.5 min readSELECT statements and that the tables from the earlier chapters exist: authors, books, book_authors, and readings. Here you combine them. The focus is on which join type to pick, why rows disappear or multiply, and how to avoid both problems.4 min readreadings table into yearly summaries. It assumes you can write basic SELECT and JOIN queries. It also assumes the books, authors, book_authors, and readings tables from the earlier chapters exist, with the reading_status enum and the CHECK constraint that all5 min readbooks table from earlier chapters, including its UNIQUE constraint on isbn13, and that you are comfortable with INSERT ... RETURNING and basic constraints. You need PostgreSQL 9.5 or newer. The tutorial already requires version 12 or newer, so you have it.5 min readbooks, authors, book_authors, and readings tables from the earlier chapters, and that you can run several statements in one psql session. Earlier chapters used data-modifying CTEs and ON CONFLICT. Here you learn what to do when a change needs more than o5 min readauthors, books, book_authors, and readings tables from earlier chapters, and that you can run psql. You should be comfortable with joins and WHERE clauses. The goal is to decide which indexes this schema needs, and to avoid adding ones it doesn't.5 min readauthors, books, book_authors, readings) and the two foreign-key indexes from the indexing chapter. You should be comfortable with joins and CREATE INDEX. By the end you will be able to read a plan, tell whether an index wa5 min readbooks, authors, book_authors, and readings tables from the earlier chapters, and that you can write joins and GROUP BY queries. You will turn the finished-books query into a view, then look at how views behave: what they store, how to change them, when the6 min readbooks table. It assumes you have the books table from the earlier chapters, with title declared NOT NULL, and a PostgreSQL 12 or newer server. The generated column used below needs version 12. You should also know what a B-tree index is. The chapter on i5 min read