Loading topic
CREATE TABLE defines a new table in a database. A table has columns, and each column describes the kind of value it stores. A table definition can also include rules that protect the data. This chapter focuses on the table structure and column definitions. Later chapters examine each constraint in2 min readSELECT, INSERT, UPDATE, and DELETE, and that you understand tables, rows, and columns. This chapter uses PostgreSQL-compatible SQL. Other database systems use many of the same types, but their exact names and behavior can differ.2 min readSELECT, INSERT, UPDATE, and DELETE, and you understand tables, rows, columns, and common data types. This chapter focuses on the working model behind SQL constraints: rules the database checks before it accepts a change.2 min readINSERT and UPDATE statements, and common SQL data types. You should also know that NULL represents a missing or unknown value. It is not the same as an empty string, zero, or FALSE.2 min readSELECT, INSERT, UPDATE, and DELETE, and understand tables, rows, columns, and common SQL data types.2 min readSELECT, INSERT, UPDATE, and DELETE, and you understand tables, rows, columns, and common data types. This chapter uses PostgreSQL-style SQL. Other database systems use similar primary-key rules, but identity-column syntax can differ.2 min readSELECT, INSERT, UPDATE, and DELETE, and that tables contain rows and columns. It also assumes you recognize common data types such as integers, text, and dates.2 min readSELECT, INSERT, UPDATE, and DELETE statements. You should also understand that a table contains rows and columns, and that common data types describe values such as integers, text, and dates.1 min readINSERT, UPDATE, and DELETE statements. In a foreign-key relationship, the parent table contains the referenced key. The child table stores a foreign key that points to it.2 min readSELECT, INSERT, UPDATE, and DELETE, and understand tables, rows, columns, and common data types. This chapter focuses on rules that validate values in one row.2 min readSELECT, INSERT, UPDATE, and DELETE, and that you understand tables, rows, columns, and common data types. You will use that knowledge to place constraints where they are easiest to read and maintain.1 min readSELECT, INSERT, UPDATE, and DELETE, and understand tables, rows, columns, and common data types. You will learn how explicit constraint names make database errors easier to read and schema changes easier to target.2 min readINSERT, UPDATE, and DELETE. This chapter focuses on changing rules after a table already exists. The examples use PostgreSQL-style syntax. Other database systems may use different names or options.1 min readSELECT, INSERT, UPDATE, and DELETE, and understand tables, rows, columns, and common data types.2 min readSELECT, INSERT, UPDATE, and DELETE, and understand tables, rows, columns, and common data types. This chapter focuses on PostgreSQL, MySQL, SQL Server, and SQLite.2 min readSELECT, INSERT, UPDATE, and DELETE statements. You should also understand tables, rows, columns, and common data types. This walkthrough uses PostgreSQL syntax, especially GENERATED ALWAYS AS IDENTITY.1 min read