text: ﻿-- Exported from QuickDBD: https://www.quickdatabasediagrams.com/
  -- Link to schema: https://app.quickdatabasediagrams.com/#/d/hwxhJ4
  -- NOTE! If you have used non-SQL datatypes in your design, you will have to change these here.
  
  
  CREATE TABLE "department" (
      "dept_no" VARCHAR   NOT NULL,
      "dept_name" VARCHAR   NOT NULL,
      CONSTRAINT "pk_department" PRIMARY KEY (
          "dept_no"
       )
  );
  
  CREATE TABLE "employee" (
      "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,
      "gender" VARCHAR(1)   NOT NULL,
      "hire_date" DATE   NOT NULL,
      CONSTRAINT "pk_employee" PRIMARY KEY (
          "emp_no"
       )
  );
  
  CREATE TABLE "dept_mgr" (
      "dept_no" VARCHAR   NOT NULL,
      "emp_no" INT   NOT NULL
  );
  
  CREATE TABLE "dept_emp" (
      "emp_no" INT   NOT NULL,
      "dept_no" VARCHAR   NOT NULL
  );
  
  CREATE TABLE "title" (
      "title_id" INT   NOT NULL,
      "title" VARCHAR   NOT NULL
  );
  
  CREATE TABLE "salary" (
      "emp_no" INT   NOT NULL,
      "salary" INT   NOT NULL
  );
  
  ALTER TABLE "employee" ADD CONSTRAINT "fk_employee_emp_title_id" FOREIGN KEY("emp_title_id")
  REFERENCES "title" ("title_id");
  
  ALTER TABLE "dept_mgr" ADD CONSTRAINT "fk_dept_mgr_dept_no" FOREIGN KEY("dept_no")
  REFERENCES "department" ("dept_no");
  
  ALTER TABLE "dept_mgr" ADD CONSTRAINT "fk_dept_mgr_emp_no" FOREIGN KEY("emp_no")
  REFERENCES "employee" ("emp_no");
  
  ALTER TABLE "dept_emp" ADD CONSTRAINT "fk_dept_emp_emp_no" FOREIGN KEY("emp_no")
  REFERENCES "employee" ("emp_no");
  
  ALTER TABLE "dept_emp" ADD CONSTRAINT "fk_dept_emp_dept_no" FOREIGN KEY("dept_no")
  REFERENCES "department" ("dept_no");
  
  ALTER TABLE "salary" ADD CONSTRAINT "fk_salary_emp_no" FOREIGN KEY("emp_no")
  REFERENCES "employee" ("emp_no");