01.09.2016 Views

Beginning Oracle Database 11g Administration From Novice to Professional

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

26<br />

CHAPTER 2 SQL AND PL/SQL<br />

Data Definition Language<br />

A large portion of the <strong>Oracle</strong> <strong>11g</strong> SQL reference manual is devoted <strong>to</strong> DDL: commands<br />

that are used <strong>to</strong> create, alter, and drop different types of database objects such as tables<br />

and indexes.<br />

Listing 2-4 shows the DDL commands that can be used <strong>to</strong> create the , ,<br />

and tables used in the first chapter. These commands specify a data type such as<br />

variable character () or numeric for each data item, the length of each data item,<br />

and, in the case of numeric data items, the precision. indicates no more than<br />

32 data characters, and indicates a decimal number with no more than eight<br />

digits, two of which are <strong>to</strong> the right of the decimal point. Each of the three tables has a<br />

primary key, and the table is linked <strong>to</strong> the other two tables by foreign keys. All data<br />

items in this example are specified <strong>to</strong> be , which simply means that their values<br />

cannot be left unspecified. Finally, note that each SQL statement is followed by a terminating<br />

semicolon.<br />

Listing 2-4. DDL Commands <strong>to</strong> Create the Supplier, Part, and Quote Tables<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<strong>Database</strong> Manipulation Language<br />

You have already seen several examples of the statement. Next, let’s consider the<br />

, , , and statements.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!