Test Your Understanding 2

Question:

Test Your Understanding 2

Modify the given query appropriately in order to create the department table using the schema given below, considering the product table that you have already created.

COLUMN NAMEDATATYPESIZECONSTRAINT
dept_idnumber4Primary key
prod_idnumber4Foreign key
dept_namevarchar225Unique
dept_headvarchar225Not null

Code:

DEPARTMENT.sql

CREATE table department
 ( dept_id number(4),
  prod_id number(4),
  dept_name varchar2(25) unique,
  dept_head varchar2(25) NOT NULL,
  PRIMARY KEY(dept_id),
  foreign KEY(prod_id) REFERENCES product(prod_id)
); 

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *

x