id int PRIMARY KEY AUTO_INCREMENT NOT NULL,
full_name varchar(45) NOT NULL ,
position varchar(45) NOT NULL,
adress varchar(45) ,
phone_number varchar(15) ,
birt_date date ,
salary decimal NOT NULL
);
CREATE TABLE customer
(
id int PRIMARY KEY AUTO_INCREMENT NOT NULL,
full_name varchar(45) NOT NULL,
adress varchar(45) ,
phone_number char(45)
);
CREATE TABLE provider
(
id int PRIMARY KEY AUTO_INCREMENT NOT NULL,
provider_name varchar(45) ,
phone_number varchar(45),
adress varchar(95)
);
CREATE TABLE delivery
(
id int PRIMARY KEY AUTO_INCREMENT NOT NULL,
id_provider int NOT NULL,
delivery_date date,
FOREIGN KEY (id_provider) references provider(id)
);
CREATE TABLE product
(
id int PRIMARY KEY AUTO_INCREMENT NOT NULL,
id_delivery int NOT NULL,
product_name varchar(45),
quantit int,
price decimal NOT NULL,
FOREIGN KEY (id_delivery) references delivery(id)
);
CREATE TABLE commission
(
id int PRIMARY KEY AUTO_INCREMENT NOT NULL,
id_employee int NOT NULL,
id_customer int NOT NULL,
FOREIGN KEY (id_employee) references employee(id),
FOREIGN KEY (id_customer) references customer(id)
);
CREATE TABLE order_transportation
(
id_product int NOT NULL,
id_order int NOT NULL ,
FOREIGN KEY (id_product) references product(id),
FOREIGN KEY (id_product) references commission(id),
PRIMARY KEY (id_product, id_order)
);
А какая нормальная форма вас интересует?
Обсуждают сегодня