Work with tables or indexes by using an SQL data-definition query
Use SQL data-definition queries to create, delete, or alter tables or create indexes in the current database.
- In the Database window, click Queries under Objects, and then click New on the Database window toolbar.
- In the New Query dialog box, click Design View, and then click OK.
- Without adding tables or queries, click Close in the Show Table dialog box.
- On the Query menu, point to SQL Specific, and then click Data Definition.
- Enter the SQL statement for your data-definition query. Each data-definition query consists of just one data-definition statement. Microsoft Access supports these data-definition statements:
- CREATE TABLE creates a table. For more information, click .
- ALTER TABLE adds a new field or constraint to an existing table. For more information, click .
- DROP deletes a table from a database or removes an index from a field or group of fields. For more information, click .
- CREATE INDEX creates an index for a field or group of fields. For more information, click .
- To run the query, click Run on the toolbar.
Caution If you convert a data-definition query to another type of query, such as a select query, you'll lose the SQL statement that you entered.
Notes
- For examples of data-definition queries, click .
- To create or change objects in ODBC database servers, such as Microsoft FoxPro, use pass-though queries instead of data-definition queries.