text: ﻿
  
  CREATE TABLE Employees (
      emp_no int   NOT NULL,
      emp_title_id varchar   NOT NULL,
      birth_date date   NOT NULL,
      first_name varchar   NOT NULL,
      last_name varchar   NOT NULL,
      sex varchar   NOT NULL,
      hire_date date   NOT NULL,
      CONSTRAINT pk_Employees PRIMARY KEY (
          emp_no
       )
  );
  
  CREATE TABLE Departments (
      dept_no varchar   NOT NULL,
      dept_name varchar   NOT NULL,
      CONSTRAINT pk_Departments PRIMARY KEY (
          dept_no
       )
  );
  
  CREATE TABLE dept_emp (
      emp_no int   NOT NULL,
      dept_no varchar   NOT NULL
  );
  
  CREATE TABLE dept_manager (
      dept_no varchar   NOT NULL,
      emp_no int   NOT NULL
  );
  
  CREATE TABLE salaries (
      emp_no int   NOT NULL,
      salary int   NOT NULL
  );
  
  CREATE TABLE titles (
      title_id varchar   NOT NULL,
      title varchar   NOT NULL,
      CONSTRAINT pk_titles PRIMARY KEY (
          title_id
       )
  );
  
  ALTER TABLE Employees ADD CONSTRAINT fk_Employees_emp_title_id FOREIGN KEY(emp_title_id)
  REFERENCES titles (title_id);
  
  ALTER TABLE dept_emp ADD CONSTRAINT fk_dept_emp_emp_no FOREIGN KEY(emp_no)
  REFERENCES Employees (emp_no);
  
  ALTER TABLE dept_emp ADD CONSTRAINT fk_dept_emp_dept_no FOREIGN KEY(dept_no)
  REFERENCES Departments (dept_no);
  
  ALTER TABLE dept_manager ADD CONSTRAINT fk_dept_manager_dept_no FOREIGN KEY(dept_no)
  REFERENCES Departments (dept_no);
  
  ALTER TABLE dept_manager ADD CONSTRAINT fk_dept_manager_emp_no FOREIGN KEY(emp_no)
  REFERENCES Employees (emp_no);
  
  ALTER TABLE salaries ADD CONSTRAINT fk_salaries_emp_no FOREIGN KEY(emp_no)
  REFERENCES Employees (emp_no);
  
  