This is homework. I have to create two tables with certain constraints. However, I keep getting syntax errors, and I really have no clue exactly how to format it because there are so many different 'templates' out there. Here is what I have so far.
create table Departments
(Department_ID number
PRIMARY KEY,
Dept_Name varchar2(25)
NOT NULL UNIQUE,
City varchar2(50)
NOT NULL,
Budget_Code char(5)
NOT NULL UNIQUE,
Mailstop char(3)
NOT NULL);
The constraints are in all caps. Also, I need to know how to do multiple constraints. Can someone help me on this?
The second table I have:
create table Employees
(Employee_ID number
PRIMARY KEY,
Last_Name varchar2(50)
NOT NULL,
First_Name varchar2(50)
NOT NULL,
State char(2),
Zipcode char(5),
e-mail varchar2(100)
UNIQUE,
Gender char(1)
NOT NULL CHECK(Gender="M" OR "F"),
Hire_Date date
NOT NULL,
Department_ID Number
NOT NULL FOREIGN KEY (Department_ID) references DEPARTMENTS(DEPARTMENT_ID));
If anyone sees errors here, please let me know. I'm still pretty new at this.