Contents Index Lesson 4: Identify and create primary keys Lesson 6: Design and create relationships between tables

ASA Getting Started
  Designing and Building Your Database
    Tutorial: Design and build a simple database

Lesson 5: Design column properties


In this lesson, you learn more about choosing data types and other attributes for the columns of your tables.

Concepts 

Each column has a data type associated with it. The data type defines the type of information the column holds. Choose a data type for the column that is appropriate for the data in the column. For example, identifier columns commonly have an integer data type, while columns holding names or addresses must have character data types.

Data types are organized into the following categories:

In addition, Adaptive Server Anywhere supports user-defined data types and special Java data types. These are not discussed in this introductory book.

NULL and NOT NULL 

If every row must contain a value for this column, you should define the column as being NOT NULL. Otherwise, the column is allowed to contain NULL, which represents a missing value. The default is to allow NULL, but you should explicitly declare columns NOT NULL unless there is a good reason to allow NULL.

For a complete description of the NULL value, see NULL value. For information on its use in comparisons, see Search conditions.

To specify a data type for a column

  1. Select the product table in the left pane, then click the Columns tab in the right pane.

  2. Select the primary key column and then choose File > Properties to open the property sheet for a column.

    The column's property sheet opens.

  3. Click the Data Type tab.

  4. Select a data type from the Built-in Type dropdown list.

Exercise 

This lesson and the last lesson have introduced the basic concepts you need to know in order to create database tables. You can put these to work by adding some more tables to your database. These tables will be used in the subsequent lessons in this chapter.

Add the following tables to your database:

You have now created four tables in your database. The tables are not yet related in any way. In the next lesson, you define foreign keys to relate the tables to one another.


Contents Index Lesson 4: Identify and create primary keys Lesson 6: Design and create relationships between tables