• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Understanding SQL Grammar

When you learn the grammar of a (new language, it's helpful to categorize the vocabulary of the language by usage and then into the familiar parts of speech. SQL commands, therefore, first are divided into six usage categories:

  • Data Query Language (DQL) consists of commands that obtain data from tables and determines how the results of the retrieval are presented. The SELECT command is the principal instruction in this category.

  • Data Manipulation Language (DML) provides INSERT and DELETE commands, which add or delete entire rows, and the UPDATE command, which changes the values of data in specified columns within rows.

  • Transaction Processing Language (TPL) includes BEGIN TRAN[SACTION], COMMIT [TRAN[SACTION]|WORK], and ROLLBACK [TRAN[SACTION]|WORK], which group multiple DML operations. If one DML operation of a transaction fails, the preceding DML operations are canceled (rolled back). Jet 4.0 SQL and T-SQL implement BEGIN TRANSACTION, COMMIT TRANSACTION|WORK, and ROLLBACK TRANSACTION|WORK; only T-SQL supports the TRAN abbreviation.

  • Data Definition Language (DDL) includes CREATE|ALTER TABLE, ADD|ALTER COLUMN, and CREATE|ALTER VIEW instructions that define the structure of tables and views. DDL commands also are used to modify tables and to create and delete indexes. The keywords that implement declarative referential integrity (DRI) are used with DDL statements. Jet SQL and T-SQL support the [CREATE|ALTER] TABLE and [CREATE|ALTER} INDEX instructions; T-SQL offers non-ANSI ALTER VIEW, [CREATE|ALTER] FUNCTION, and [CREATE|ALTER] PROCEDURE statements.

  • Cursor Control Language (CCL) can select a single row of a query result set for processing. Cursor control constructs, such as UPDATE WHERE CURRENT, are handled by ADO's cursor engine or the Jet database engine, so these commands aren't discussed in this chapter.

  • Data Control Language (DCL) performs administrative functions that grant and revoke privileges to use the database, such as GRANT and REVOKE, a set of tables within the database, or specific SQL commands.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint