Database Reference
In-Depth Information
You can use the SQL DROP TABLE command to delete a table that is no longer needed. For example, to
delete the SmallCust table (created in Chapter 3) from the Premiere Products database, you would use the
following command:
DROP TABLE SmallCust
;
139
The table and all indexes and views defined on the table would be deleted. The DROP TABLE command
deletes the table structure as well as its data.
In Access, you can drop (delete) a table, such as the SmallCust table created in Chapter 3, by right-
clicking the table on the Navigation Pane and then clicking Delete on the shortcut menu, as shown in
Figure 4-25. Access will open a dialog box and ask you to confirm the deletion by clicking the Yes button,
and then Access will delete the table from the database.
Table to be
deleted
Delete command on
the shortcut menu
FIGURE 4-25
Deleting a table in Access
Making Complex Changes
In some cases, you might need to change a table
s structure in ways that are beyond the capabilities of your
DBMS. Perhaps you need to eliminate a field, change the field order, or combine data from two tables into one,
but your system does not allow these types of changes. For example, some systems, including Oracle, do not
allow you to reduce the size of a field or change its data type. In these situations, you can use the CREATE
TABLE command to describe the new table, and then insert values into it using the INSERT command combined
with an appropriate SELECT clause, as you learned in Chapter 3. If you are using a version of SQL that supports
the SELECT INTO command, as Access does, you can use it to create the new table in a single operation.
'
Search WWH ::




Custom Search