Loading topic
ALTER TABLE to DROP TABLE, builds on the ideas here.5 min readSELECT, INSERT, UPDATE and DELETE statements, and that you know CREATE TABLE, common data types, and primary and foreign keys. You should have a test database available (PostgreSQL, MySQL, SQL Server or SQLite). The examples use PostgreSQL unless a 5 min readALTER TABLE ... ADD COLUMN. It assumes you can write CREATE TABLE with common data types, understand primary and foreign keys, and have a test database such as PostgreSQL, MySQL, SQL Server or SQLite. Run every example on a test database, not on data you care about.5 min readCREATE TABLE with column types, and that you know what NULL means and how UPDATE ... WHERE works. The examples use PostgreSQL syntax, and the differences in MyS5 min readCREATE TABLE and basic SELECT, INSERT, UPDATE and DELETE statements. It also assumes you know what primary keys, foreign keys and views are. Run the examples on a throwaway database, because a dropped column cannot be recovered with SQL alone.5 min readCREATE TABLE, know the common data types (INTEGER, VARCHAR, NUMERIC, TIMESTAMP), and have used ALTER TABLE ... ADD COLUMN. It covers how to change the data type of an existing column, what the database does while it does so, and the errors you are most 5 min readCREATE TABLE, you know what primary and foreign keys are, and you have a test database (PostgreSQL, MySQL, SQL Server or SQLite). You should also know the basic ALTER TABLE shape from the earlier chapters: ALTER TABLE table_name action.5 min readCREATE TABLE, know what primary and foreign keys are, and have read the earlier chapters on ALTER TABLE structure and columns. The examples use PostgreSQL syntax. Dialect differences are collected in a table near the end.4 min readDROP TABLE removes, what it needs to run, and how to use it without losing data you still need. It assumes you can write CREATE TABLE, know what a primary key and foreign key are, and have a test database (PostgreSQL, MySQL, SQL Server or SQLite) where you can experiment5 min readCREATE TABLE, ALTER TABLE ... ADD COLUMN and DROP TABLE, and that you know what a foreign key does. The examples use PostgreSQL unless a heading says otherwise. You can follow them in any test database, but the dialect section shows where other systems differ5 min readCREATE TABLE, define primary and foreign keys, and have run ALTER TABLE and DROP TABLE on a test database. The examples use PostgreSQL. Where MySQL, SQL Server or SQLite behave differently, the text says so.3 min readCREATE TABLE with primary and foreign keys, and that you have met DROP TABLE and IF EXISTS in earlier chapters. The examples use PostgreSQL, because it implements both keywords fully. The dialect section shows how other systems differ.4 min readSELECT, INSERT, UPDATE and DELETE statements, and that you know primary keys and foreign keys. The examples use PostgreSQL unless a comment says otherwise. Run them on a test database, not on data you care about.4 min readBEGIN, COMMIT and ROLLBACK for DML, and that you have met ALTER TABLE and DROP TABLE in earlier chapters. You will learn which databases let you undo a schema change, which ones commit it behind your back, and how to write migration scripts that stay safe eith5 min readCREATE TABLE, know primary and foreign keys, and have run ALTER TABLE ... ADD COLUMN on at least one database. Here you will learn where the major dialects (PostgreSQL, MySQL, SQL Server, Oracle and SQLite) disagree about ALTER TABLE and DROP TABLE. You wil5 min readALTER TABLE statements (add, drop and retype columns), that you understand transactions, and that you have a PostgreSQL or MySQL test database. You have already seen that ALTER TABLE changes structure. Here the question is what it costs while it runs on a6 min readALTER TABLE forms (add, drop, retype and rename columns, add and drop constraints), DROP TABLE with IF EXISTS, and the difference between CASCADE and RESTRICT. The examples use PostgreSQL. Where other databases behave differently, the text says so.5 min read