Creating, Dropping, Indexing, and Altering Tables
MySQL allows you to create tables, drop (remove) them, and change their structure using the CREATE TABLE, DROP TABLE, and ALTER TABLE statements. For each of these statements, there are MySQL-specific extensions that make them more useful. The CREATE INDEX and DROP INDEX statements allow you to add or remove indexes on existing tables.
The CREATE TABLE Statement
Tables are created with CREATE TABLE. The full syntax for this statement is pretty horrendous because there are so many optional clauses, but in practice this statement is usually fairly simple to use. For example, all of the CREATE TABLE statements that we used in Chapter 1 are reasonably uncomplicated.
Ironically, much of this additional ...
Get MySQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.