Udostępnij za pośrednictwem


Tables (Visual Database Tools)

A database consists of one or more tables. A table is a collection of data, arranged in rows and columns. For example, you might have a table for author information called authors. Each column would contain a certain type of information, such as the author's last name. Each row would contain all the information about a specific author: first name, last name, address, and so on.

In a database, you might have a number of tables, each devoted to a specific topic. For example, the pubs database might contain tables for authors, titles, and so on. Using a separate table for each topic can eliminate duplicate data, make data storage more efficient, and reduce data-entry errors.

Designing Tables

To determine the structure of a new table, you need to decide:

  • What type of data the table will contain.

  • What columns you need in the table and the data type (and length, if required) for each column.

  • Which columns should accept null values. For information about data types, allowing null values, and other column properties, see Working with Columns.

  • Whether to use constraints and if so, where. For more information, see Working with Constraints.

  • What types of indexes you need, where you need them, and which columns should be the primary key and foreign key. For more information, see Working with Indexes and Working with Keys.

After you decide on the structure of your table, you can create the table and define its columns with the Table Designer. When you save your table, it is created in your database.

If you know exactly what you want in a table, it is often most efficient to define everything you need at the beginning, including the table's data restrictions and additional properties. However, in many cases, you will do best to first create a basic table and save it so it is created in your database. You can then add some test data to the table and experiment with the table to fine-tune its design. Through experimentation, you can determine what types of data are frequently entered and queried and then redesign your table accordingly.

When you change a table's design, any data that is stored in the table is preserved to the extent possible. When you are satisfied with your basic design, you can add constraints, indexes, and any additional columns that you require. For more information, see Designing Tables.

For information about

See

Adding new tables to your database.

How to: Create Tables

Creating a new table that contains some of the same columns as an existing table in your diagram

How to: Duplicate Tables

Deleting a table from a database

How to: Delete Tables from a Database

Changing the name of a table in a database

How to: Rename Tables

Adding or deleting columns in a table, or changing column property settings

Working with Columns

See Also

Other Resources

Working with Tables in Table Designer

Designing Tables