Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Tutorial: Creating a SQL Anywhere Database

Lesson 3: Create a table Next Page

Lesson 4: Set column properties

In this lesson, you learn how to add a NOT NULL constraint on a column.


Every product in the Products table must have an associated product ID. Therefore, for each row in the Products table, the ID column must contain a value.

You can ensure that each row in the column contains a value for the ID column by defining the column as NOT NULL.

By default, columns allow NULLs, but you should explicitly declare columns NOT NULL unless there is a good reason to allow NULLs. See NULL value.

To define a column as NOT NULL
  1. Open the Tables folder.

  2. Select the Products table in the left pane, and then click the Columns tab in the right pane.

  3. Select the ProductID column.

  4. From the File menu, choose Properties to open the Column property sheet.

  5. On the Constraints tab, select Values Cannot be NULL.

  6. Click OK.

This lesson and the previous lesson introduced the basic concepts you need to know to create database tables. You can practice what you have learned by adding some more tables to your database. These tables are used in the subsequent lesson 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.