|
|
|
@ -6,19 +6,19 @@ DROP DATABASE IF EXISTS collaborateur_epa; |
|
|
|
|
CREATE DATABASE IF NOT EXISTS collaborateur_epa /*!40100 DEFAULT CHARACTER SET latin1 */; |
|
|
|
|
USE collaborateur_epa; |
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS agence; |
|
|
|
|
CREATE TABLE IF NOT EXISTS agence( |
|
|
|
|
DROP TABLE IF EXISTS businessunit; |
|
|
|
|
CREATE TABLE IF NOT EXISTS businessunit( |
|
|
|
|
Id int NOT NULL AUTO_INCREMENT, |
|
|
|
|
Name varchar(100) NOT NULL UNIQUE, |
|
|
|
|
PRIMARY KEY (Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS businessunit; |
|
|
|
|
CREATE TABLE IF NOT EXISTS businessunit( |
|
|
|
|
DROP TABLE IF EXISTS agence; |
|
|
|
|
CREATE TABLE IF NOT EXISTS agence( |
|
|
|
|
Id int NOT NULL AUTO_INCREMENT, |
|
|
|
|
Name varchar(100) NOT NULL UNIQUE, |
|
|
|
|
agenceId int NOT NULL, |
|
|
|
|
CONSTRAINT FK_BUSINESS_UNIT_AGENCE FOREIGN KEY (agenceId) references agence(Id), |
|
|
|
|
BusinessUnitId int NOT NULL, |
|
|
|
|
CONSTRAINT FK_BUSINESS_UNIT_AGENCE FOREIGN KEY (BusinessUnitId) references businessunit(Id), |
|
|
|
|
PRIMARY KEY (Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS collaborateur( |
|
|
|
|
Address varchar(200) NOT NULL, |
|
|
|
|
Telephone varchar(15) NOT NULL, |
|
|
|
|
PersonalMail varchar(100) NOT NULL, |
|
|
|
|
ApsideMail varchar(100) NOT NULL, |
|
|
|
|
ApsideMail varchar(100) NOT NULL UNIQUE, |
|
|
|
|
ResignationDate date NOT NULL, |
|
|
|
|
businessunitId int NOT NUll, |
|
|
|
|
ReferrerId int NOT NULL, |
|
|
|
@ -43,8 +43,9 @@ CREATE TABLE IF NOT EXISTS collaborateur( |
|
|
|
|
PRIMARY KEY (Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
INSERT INTO agence(Id, Name) VALUES (1,'Clermont-Ferrand'); |
|
|
|
|
INSERT INTO businessunit(Id, Name, agenceId) VALUES (1,'Cournon',1); |
|
|
|
|
|
|
|
|
|
INSERT INTO businessunit(Id, Name) VALUES (1,'Business Unit Clermont-Ferrand'); |
|
|
|
|
INSERT INTO agence(Id, Name, BusinessUnitId) VALUES (1,'Cournon',1); |
|
|
|
|
INSERT INTO collaborateur(Name, FirstName, BirthDate, Gender, Status, ChildrenNumber, Address, Telephone, PersonalMail, |
|
|
|
|
ApsideMail, ResignationDate, businessunitId, ReferrerId) |
|
|
|
|
VALUES ('Dupont','Marie','1990-08-08','feminin','cadre',0,'adresse','tel','pmail','amail','2030-08-08',1,1); |
|
|
|
|