O'Reilly logo

Sams Teach Yourself SQL in 24 Hours, Fifth Edition by Arie D. Jones, Ron D. Plew, Ryan Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Common SQL Commands

This appendix details some of the most common SQL commands that you will use. As we have stated throughout the book, check your database documentation, because some of the statements vary depending upon your implementation.

SQL Statements

ALTER TABLE

ALTER TABLE TABLE_NAME[MODIFY | ADD | DROP]  [COLUMN COLUMN_NAME][DATATYPE|NULL NOT NULL] [RESTRICT|CASCADE][ADD | DROP]  CONSTRAINT CONSTRAINT_NAME]

Description: Alters a table’s columns.

COMMIT

COMMIT [ TRANSACTION ]

Description: Saves a transaction to the database.

CREATE INDEX

CREATE INDEX INDEX_NAMEON TABLE_NAME (COLUMN_NAME)

Description: Creates an index on a table.

CREATE ROLE

CREATE ROLE ROLE NAME[ WITH ADMIN [CURRENT_USER | CURRENT_ROLE]] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required