text: ﻿-- Exported from QuickDBD: https://www.quickdatabasediagrams.com/
  -- NOTE! If you have used non-SQL datatypes in your design, you will have to change these here.
  
  -- Modify this code to update the DB schema diagram.
  -- To reset the sample schema, replace everything with
  -- two dots ('..' - without quotes).
  
  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 Salaries (
      emp_no int   NOT NULL,
      salary int   NOT NULL
  );
  
  CREATE TABLE Titles (
      title_id varchar   NOT NULL,
      title varchar   NOT NULL
  );
  
  CREATE TABLE Departments (
      dept_no varchar   NOT NULL,
      dept_name varchar   NOT NULL,
      CONSTRAINT pk_Departments PRIMARY KEY (
          dept_no
       )
  );
  
  CREATE TABLE Dept_manager (
      dept_no varchar   NOT NULL,
      emp_no int   NOT NULL
  );
  
  CREATE TABLE Dept_emp (
      emp_no int   NOT NULL,
      dept_no varchar   NOT NULL
  );
  
  ALTER TABLE Salaries ADD CONSTRAINT fk_Salaries_emp_no FOREIGN KEY(emp_no)
  REFERENCES Employees (emp_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 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);
  
  