Sql Database - Gummy27/KEST3LN05EU_Lokaverkefni GitHub Wiki
MySql dump
create table Jobs(
jobId int primary key not null,
jobTitle varchar(255) not null,
minSalary int not null,
maxSalary int not null
);
create table Employees(
employeeId int primary key not null,
kennitala varchar(10) not null,
firstName varchar(255) not null,
lastName varchar(255) not null,
email varchar(255) not null,
phoneNumber int not null,
jobId int not null,
hireDate date not null,
salary int not null,
foreign key(jobId) references Jobs(jobId),
departmentId int not null
);
create table Locations(
locationId int primary key not null,
city varchar(255) not null,
address varchar(255) not null,
zipCode int not null
);
create table Departments(
departmentId int primary key not null,
managerId int not null,
locationId int not null,
departmentName varchar(255) not null,
FOREIGN KEY(managerId) REFERENCES Employees(employeeId),
foreign key(locationId) references Locations(locationId)
);
ALTER TABLE Employees
ADD FOREIGN KEY (departmentId) REFERENCES Departments(departmentId);