This SQL reference is designed to help you with any questions you may have when going through this book. This is not meant to be a 100 percent total SQL reference; that requires an entire book on its own. Instead, this appendix contains the SQL keywords and the most common ways you may see them when working with MySQL.
For any of these statements, you need to be logged in to the database server and have the proper permissions to execute the commands. Contact your database administrator, or check out your databases documentation if you run into issues.
ALTER is used to modify the structure in an existing table. It allows you to add, delete, or modify columns and to remove indexes from existing tables.
To add a new column to an existing table:
ALTER TABLE library ADD foo CHAR(50);
To remove a column from a table:
ALTER TABLE library DROP foo;
To change a column's type:
ALTER TABLE library MODIFY foo INT;
To remove the isbn index from a table:
ALTER TABLE library DROP INDEX isbn;