Commit 7273a52d authored by j38560's avatar j38560

Added SQL files from example schema...

Added SQL files from example schema https://github.com/datacharmer/test_db/blob/master/employees_partitioned.sql
parent 6683d94c
use performance;
ALTER TABLE dept_emp
ADD FOREIGN KEY (emp_no) REFERENCES employees (emp_no) ON DELETE CASCADE;
ALTER TABLE dept_emp
ADD FOREIGN KEY (dept_no) REFERENCES departments (dept_no) ON DELETE CASCADE;
use performance;
ALTER TABLE dept_manager
ADD FOREIGN KEY (emp_no) REFERENCES employees (emp_no) ON DELETE CASCADE;
ALTER TABLE dept_manager
ADD FOREIGN KEY (dept_no) REFERENCES departments (dept_no) ON DELETE CASCADE;
create database performance;
\ No newline at end of file
use performance;
CREATE TABLE departments (
dept_no CHAR(4) NOT NULL,
dept_name VARCHAR(40) NOT NULL,
PRIMARY KEY (dept_no),
UNIQUE KEY (dept_name)
);
\ No newline at end of file
use performance;
CREATE TABLE dept_emp (
emp_no INT NOT NULL,
dept_no CHAR(4) NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
PRIMARY KEY (emp_no,dept_no)
);
\ No newline at end of file
use performance;
CREATE TABLE dept_manager (
emp_no INT NOT NULL,
dept_no CHAR(4) NOT NULL,
from_date DATE NOT NULL,
to_date DATE NOT NULL,
PRIMARY KEY (emp_no,dept_no)
);
\ No newline at end of file
use performance;
CREATE TABLE employees (
emp_no INT NOT NULL,
birth_date DATE NOT NULL,
first_name VARCHAR(14) NOT NULL,
last_name VARCHAR(16) NOT NULL,
gender ENUM ('M','F') NOT NULL,
hire_date DATE NOT NULL,
PRIMARY KEY (emp_no)
);
\ No newline at end of file
use performance;
CREATE TABLE titles (
emp_no INT NOT NULL,
title VARCHAR(50) NOT NULL,
from_date DATE NOT NULL,
to_date DATE,
PRIMARY KEY (emp_no,title, from_date)
);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment