Creating the Department Table
Creating the Department Table
Next, you create the Department table. This table has only two columns to begin with. Later, you use the ALTER TABLE command to add to it. Type in the complete SQL statement and then execute it:
- CREATE TABLE Department (
- dept_no DEPTNO NOT NULL PRIMARY KEY,
- department VARCHAR(25) NOT NULL UNIQUE)
- CREATE TABLE Department (
The dept_no column is the primary key for the table and is therefore UNIQUE. Primary keys are discussed on page 14. Notice that the department column value must be unique and that neither column can be null.