113 lines
9.3 KiB
HTML
113 lines
9.3 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Data definition language (DDL)" />
|
||
|
<meta name="abstract" content="Data definition language (DDL) describes the portion of SQL that allows you to create, alter, and destroy database objects. These database objects include schemas, tables, views, sequences, catalogs, indexes, and aliases." />
|
||
|
<meta name="description" content="Data definition language (DDL) describes the portion of SQL that allows you to create, alter, and destroy database objects. These database objects include schemas, tables, views, sequences, catalogs, indexes, and aliases." />
|
||
|
<meta name="DC.subject" content="data definition statements (DDL)" />
|
||
|
<meta name="keywords" content="data definition statements (DDL)" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafykickoff.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafysqlpcschema.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafysqlpctablecreate.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafycrttbllike.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafycrttblas.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafymqt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafydeclaretemptbl.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafysqlpidentity.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyrowid.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafysequence.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafycreatinglabelon.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafydescribingcommenton.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyalter.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafycreatingalias.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyviewnt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafycrtindx.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafydbcat.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafysqlpcdropping.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafystmtype.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../rzatc/rzatcgetstartsql.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbafysqltech" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Data definition language (DDL)</title>
|
||
|
</head>
|
||
|
<body id="rbafysqltech"><a name="rbafysqltech"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Data definition language (DDL)</h1>
|
||
|
<div><p>Data definition language (DDL) describes the portion
|
||
|
of SQL that allows you to create, alter, and destroy database objects. These
|
||
|
database objects include schemas, tables, views, sequences, catalogs, indexes,
|
||
|
and aliases.</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rbafysqlpcschema.htm">Create a schema</a></strong><br />
|
||
|
A schema provides a logical grouping of SQL objects.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafysqlpctablecreate.htm">Create a table</a></strong><br />
|
||
|
A table can be visualized as a two-dimensional arrangement of data consisting of rows and columns.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafycrttbllike.htm">Create a table using LIKE</a></strong><br />
|
||
|
You can create a table that looks like another table. That is, you can create a table that includes all of the column definitions from an existing table.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafycrttblas.htm">Create a table using AS</a></strong><br />
|
||
|
The CREATE TABLE AS statement creates a table from the result of a SELECT statement.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafymqt.htm">Create and alter a materialized query table</a></strong><br />
|
||
|
A materialized query table is a table whose definition is based on the result of a query. As such, the materialized query table typically contains precomputed results based on the data existing in the table or tables that its definition is based on.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafydeclaretemptbl.htm">Declare a global temporary table</a></strong><br />
|
||
|
You can create a temporary table for use with your current session using the DECLARE GLOBAL TEMPORARY TABLE statement.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafysqlpidentity.htm">Create and alter an identity column</a></strong><br />
|
||
|
Every time that a new row is added to a table with an identity column, the identity column value in the new row is incremented (or decremented) by the system.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafyrowid.htm">Use ROWID</a></strong><br />
|
||
|
Using ROWID is another way to have the system assign a unique value to a column in a table. ROWID is similar to identity columns, but rather than being an attribute of a numeric column, it is a separate data type.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafysequence.htm">Create and use sequences</a></strong><br />
|
||
|
A sequence is an object that allows you to generate values quickly and easily.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafycreatinglabelon.htm">Create descriptive labels using the LABEL ON statement</a></strong><br />
|
||
|
<span>Sometimes the table name, column name, view
|
||
|
name, index name, sequence name, alias name, or SQL package name does not
|
||
|
clearly define data that is shown on an interactive display of the table.
|
||
|
You can create a more descriptive label for these names by using the LABEL
|
||
|
ON statement.</span></li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafydescribingcommenton.htm">Describe an SQL object using COMMENT ON</a></strong><br />
|
||
|
<span>After you create an SQL object such as a table,
|
||
|
view, index, package, procedure, parameter, user-defined type, function, trigger,
|
||
|
or sequence, you can supply information about it for future reference. You
|
||
|
can add information by using the COMMENT ON statement.</span></li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafyalter.htm">Change a table definition</a></strong><br />
|
||
|
Changing the definition of a table allows you to add new columns, change an existing column definition (change its length, default value, and so on), drop existing columns, and add and remove constraints.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafycreatingalias.htm">Create and use ALIAS names</a></strong><br />
|
||
|
When you refer to an existing table or view, or to a physical file that consists of multiple members, you can avoid using file overrides by creating an alias. You can use the SQL CREATE ALIAS statement to do this.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafyviewnt.htm">Create and use views</a></strong><br />
|
||
|
A view can be used to access data in one or more tables or views. You create a view by using a SELECT statement.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafycrtindx.htm">Add indexes</a></strong><br />
|
||
|
You can use indexes to sort and select data. In addition, indexes help the system retrieve data faster for better query performance.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafydbcat.htm">Catalogs in database design</a></strong><br />
|
||
|
A catalog is automatically created when you create a schema. There is also a system-wide catalog that is always in the QSYS2 library.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rbafysqlpcdropping.htm">Drop a database object</a></strong><br />
|
||
|
The DROP statement deletes an object. Depending on the action requested, any objects that are directly or indirectly dependent on that object might also be deleted or might prevent the drop from happening.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafykickoff.htm" title="These topics describe the iSeries server implementation of the Structured Query Language (SQL) using DB2 UDB for iSeries and the DB2 UDB Query Manager and SQL Development Kit Version 5 licensed program.">SQL programming</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="rbafystmtype.htm" title="There are several basic types of SQL statements. They are listed here according to their function.">Types of SQL statements</a></div>
|
||
|
</div>
|
||
|
<div class="relinfo"><strong>Related information</strong><br />
|
||
|
<div><a href="../rzatc/rzatcgetstartsql.htm">Get started with SQL</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|