Tag archive
Commands grouped around the same concept, pattern, or recurring problem.
Extend a table's structure by adding a new column with `ALTER TABLE`.
Modify the data type, default value, or nullability of an existing column without recreating the table.
Save a `SELECT` statement as a named view so it can be queried like a table.
Define a new table with column names and data types using `CREATE TABLE`.
Permanently remove a table and all its data with `DROP TABLE`.
Create a unique index so the database rejects duplicate values in one or more columns.
Define a column default so inserts can omit routine values and still store a complete row.
Define an identity or auto-increment column so new rows receive numeric IDs without the insert supplying them.
Inspect a table definition to see its column names and data types.
Inspect the current database or schema to see which tables exist.
Permanently delete a column and all its data from a table using ALTER TABLE.
Drop an index that is no longer useful so writes no longer have to maintain it.
Change a column's name in place without dropping or recreating the table or its data.
Change a table name while keeping its existing rows and columns.
Create an index on one or more columns to make lookups and joins faster.
Define a column whose value is always derived from an expression over other columns — the database recomputes or stores it on every write so queries never need to repeat the formula.
Use a `CHECK` constraint to reject rows whose values fall outside an allowed rule.
Schema and metadata choices tend to survive longer than any one statement, which is why naming and structure deserve more care than a temporary query draft.