Java Reference
In-Depth Information
various other getter methods you might not expect to work, since JDBC will attempt to
perform the required data type
Data Definition Language
SQL's Data Definition Language (DDL) is used to create and modify a database. In
other words, the DDL is concerned with changing the structure of a database. The
SQL2 standard refers to DDL statements as "SQL Schema Statements" and specifies
only aspects of the DDL that are independent of the underlying operating system and
physical-storage media. In p ractice, all commercial RDBMS systems contain
proprietary extensions to handle these aspects of the implementation.
The main commands in the DDL are CREATE, ALTER, and DROP. These
commands, together with the database elements they can work with, are shown in
Table 3 -2 .
Table 3-2: DDL Commands
COMMAND
DATA-BASE TABLE
VIEW
I NDEX
FUNC-TION PROCE-DURE TRIGGER
C REATE
YES
YES
YES
YES
YES
YES
YES
ALTER
N O
YES
YES
N O
N O
N O
N O
D ROP
YES
YES
YES
YES
YES
YES
YES
Creating, Dropping, and Altering Databases and Tables
The basic SQL command used to create a database is straightforward, as you can
see here:
CREATE DATABASE CONTACTS;
Most RDBMS systems support extended versions of the command, allowing you to
specify the files or file groups to be used, as well as a number of other parameters
such as log-file names. If you plan to use more than the basic command, refer to the
documentation for your specific RDBMS.
The SQL command used to remove a database is as simple as the CREATE
DATABASE command. The SQL DROP command is used:
DROP DATABASE CONTACTS;
Relational databases store data in tables. Most databases may contain a number of
different tables, each containing different types of data, depending on the application.
Tables are intended to store logically related data items together, so a database may
contain one table for business contacts, another for projects, and so on.
 
Search WWH ::




Custom Search