Prev | Current Page 405 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"

This syntax, too, varies by database vendor, so you must consult the documentation of your
DBMS for implementation specifics.
Having created tables in the database, one sometimes must dispose of them. One might guess that the keyword
would be ???delete??? or ???dispose??? or ???destroy???. While ???delete??? is a key word in SQL, it is used for removing
data from the database, not for getting rid of structures like a table. The way to remove a database object
like a table is to use the DROP command. Here is the syntax:
DROP < object_type > < object_name >;
The key word DROP must be followed by the type of database structure and the name of the database structure.
Object types include TABLE, VIEW, PROCEDURE (stored procedure), TRIGGER and some others.
CHAP. 8] DATABASE 149
To dispose of the Student table, one can use this command:
DROP TABLE Student;
When one must modify a database object like a table, the command to use is ALTER. For instance, to
add a birthdate column to the student table, one could use this command to add a column named Birthdate
of data type Date:
ALTER TABLE Student ADD COLUMN Birthdate Date;
In addition to adding columns, one can use the ALTER TABLE command to drop columns, add or drop
constraints, and set or drop defaults.


Pages:
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
Pozycjonowanie implanty łódź Gallery of Bialowieza narzędzia pozycjonowanie