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.

Oracle does not accepts the "-" sign for the columns. If you want your column to be called e-mail then make it "e-mail".
And your foreign key declaration is not good,

commented: agree +13

Okay, thanks. So how should the foreign key declaration go? I followed a template I found, but I guess it may be wrong.

here is an example
CREATE TABLE products
( product_id numeric(10) not null,
supplier_id numeric(10) not null,
CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES supplier(supplier_id)
);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.