Table Planning Guidelines
When you design a database, you must first decide the tables that it needs, the type of data that goes in each table, and the users that can access each table. Before you create a table and its objects, it is a good idea to outline your plans and to make decisions about the following characteristics of the table:
- The types of data the table will contain.
- The number of columns in the table and, for each column, the data type and length, if it is required.
- Which columns will accept null values.
- Whether and where to use constraints or defaults and rules.
- The types of indexes that will be needed, where required, and which columns are primary keys and which are foreign keys.
The most efficient way to create a table is to define everything that you need in the table at the same time. This includes its data restrictions and additional components. After you create and work with tables, you can continue to make more detailed decisions about them.
A useful approach to creating tables is to create a basic table, add some data to it, and then work with it for a while. This approach gives you a chance to see what types of transactions are most common and what types of data is frequently entered before you commit to a firm design by adding constraints, indexes, defaults, rules, and other objects.