Appendix B: Common SQL Reference

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

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;



Perl Database Programming
Perl Database Programming
ISBN: 0764549561
EAN: 2147483647
Year: 2001
Pages: 175

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net