Teach Yourself SQL in 21 Days, Second Edition

Previous chapterNext chapterContents

Week 2 In Review

Week 1 spent a great deal of time introducing a very important topic: the SELECT statement. Week 2 branched out into various topics that collectively form a thorough introduction to the Structured Query Language (SQL).

Day 8 introduced data manipulation language (DML) statements, which are SQL statements that you can use to modify the data within a database. The three commands most commonly used are INSERT, DELETE, and UPDATE. Day 9 described how to design and build a database and introduced the commands CREATE DATABASE and CREATE TABLE. A table can be created with any number of fields, each of which can be a database-vendor-defined data type. The ALTER DATABASE command can change the physical size or location of a database. The DROP DATABASE and DROP TABLE statements, respectively, remove a database or remove a table within a database.

Day 10 explained two ways to display data: the view and the index. A view is a virtual table created from the output of a SELECT statement. An index orders the records within a table based on the contents of a field or fields.

Day 11 covered transaction management, which was your first taste of programming with SQL. Transactions start with the BEGIN TRANSACTION statement. The COMMIT TRANSACTION saves the work of a transaction. The ROLLBACK TRANSACTION command cancels the work of a transaction.

Day 12 focused on database security. Although the implementation of database security varies widely among database products, most implementations use the GRANT and REVOKE commands. The GRANT command grants permissions to a user. The REVOKE command removes these permissions.

Day 13 focused on developing application programs using SQL. Static SQL typically involves the use of a precompiler and is static at runtime. Dynamic SQL is very flexible and has become very popular in the last few years. Sample programs used Dynamic SQL with the Visual C++ and Delphi development toolkits.

Day 14 covered advanced aspects of SQL. Cursors can scroll through a set of records. Stored procedures are database objects that execute several SQL statements in a row. Stored procedures can accept and return values. Triggers are a special type of stored procedure that are executed when records are inserted, updated, or deleted within a table.

Previous chapterNext chapterContents

Macmillan Computer Publishing USA

© Copyright, Macmillan Computer Publishing. All rights reserved.

Casa de Bender