23.10.2012 Views

Structured Query Language (SQL) - Cultural View of Technology

Structured Query Language (SQL) - Cultural View of Technology

Structured Query Language (SQL) - Cultural View of Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Data Definition <strong>Language</strong> 34<br />

The DROP statement is distinct from the DELETE and (non-standard) TRUNCATE statements, in that they do not<br />

remove the table itself. For example, a DELETE statement might delete some (or all) data from a table while leaving<br />

the table itself in the database, whereas a DROP statement would remove the entire table from the database.<br />

ALTER statements<br />

Alter - To modify an existing database object.<br />

An ALTER statement in <strong>SQL</strong> changes the properties <strong>of</strong> an object inside <strong>of</strong> a relational database management system<br />

(RDBMS). The types <strong>of</strong> objects that can be altered depends on which RDBMS is being used.<br />

The typical usage is ALTER objecttype objectname parameters. For example, the command to add (then remove) a<br />

column named bubbles for an existing table named sink would be:<br />

ALTER TABLE sink ADD bubbles INTEGER;<br />

ALTER TABLE sink DROP COLUMN bubbles;<br />

Referential integrity statements<br />

Finally, other kind <strong>of</strong> DDL sentence in <strong>SQL</strong> are the statements to define referential integrity relationships, usually<br />

implemented as primary key and foreign key tags in some columns <strong>of</strong> the tables.<br />

These two statements can be included inside a CREATE TABLE or an ALTER TABLE sentence.<br />

XML Schema<br />

XML Schema is an example <strong>of</strong> a pure DDL (although only relevant in the context <strong>of</strong> XML).<br />

DDL Tools and Related Applications<br />

Apache DdlUtils<br />

Apache DdlUtils [1] is a small, easy-to-use component for working with Database Definition (DDL) files. These are<br />

XML files that contain the definition <strong>of</strong> a database schema, e.g. tables and columns. These files can be fed into<br />

DdlUtils via its Ant task or programmatically in order to create the corresponding database or alter it so that it<br />

corresponds to the DDL. Likewise, DdlUtils can generate a DDL file for an existing database.<br />

See also<br />

• Data Manipulation <strong>Language</strong><br />

• Data Control <strong>Language</strong><br />

References<br />

[1] http://db.apache.org/ddlutils/

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

Saved successfully!

Ooh no, something went wrong!