text: ﻿DROP TABLE IF EXISTS titles CASCADE;
  DROP TABLE IF EXISTS employees CASCADE;
  DROP TABLE IF EXISTS departments CASCADE;
  DROP TABLE IF EXISTS dept_manager;
  DROP TABLE IF EXISTS dept_emp;
  DROP TABLE IF EXISTS salaries;
  
  -- Create the titles table, with a primary id and a title
  CREATE TABLE titles(
  	title_id VARCHAR(5) PRIMARY KEY,
  	title VARCHAR(20)
  );
  
  
  -- Create an employees table, with the following: 
  --    employee number, 
  --    employee title id,
  --    birth date
  --    first name
  --    last name
  --    sex
  --    hire date
  -- set the foreign key and primary key relationships accordingly
  
  CREATE TABLE employees(
  	emp_no INT PRIMARY KEY,
  	emp_title_id VARCHAR,
  	birth_date DATE,
  	first_name VARCHAR,
  	last_name VARCHAR,
  	sex VARCHAR,
  	hire_date DATE,
  	FOREIGN KEY (emp_title_id) REFERENCES titles(title_id)
  );
  
  
  -- Create an departments table, with the following: 
  --    department number, 
  --    department name
  -- set the primary key relationships accordingly
  
  CREATE TABLE departments(
  	dept_no VARCHAR PRIMARY KEY,
  	dept_name VARCHAR
  );
  
  
  -- Create an dept_manager table, with the following: 
  --    department number, 
  --    employee number
  -- set the foreign key and primary key relationships accordingly
  
  CREATE TABLE dept_manager(
  	dept_no VARCHAR,
  	emp_no INT,
  	PRIMARY KEY (dept_no, emp_no),
  	FOREIGN KEY (dept_no) REFERENCES departments(dept_no),
  	FOREIGN KEY (emp_no) REFERENCES employees(emp_no)
  );
  
  
  -- Create an dept_emp table, with the following: 
  --    department number, 
  --    employee number
  -- set the foreign key and primary key relationships accordingly
  
  CREATE TABLE dept_emp(
  	 emp_no INT,
  	 dept_no VARCHAR,
  	 FOREIGN KEY (dept_no) REFERENCES departments(dept_no),
  	 FOREIGN KEY (emp_no) REFERENCES employees(emp_no),
  	 PRIMARY KEY (emp_no, dept_no)
  );
  
  
  -- Create an salaries table, with the following: 
  --    salary 
  --    employee number
  -- set the foreign key and primary key relationships accordingly
  
  CREATE TABLE salaries (
  	emp_no INT,
  	salary INT,
  	FOREIGN KEY(emp_no) REFERENCES employees(emp_no),
  	PRIMARY KEY (emp_no)
  );
  
  
  