Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table Categories(
- CategoryID number(4),
- CategoryName varchar2(40),
- OtherCatID number(4),
- constraint pk_cat primary key(CategoryID),
- constraint fk_cat FOREIGN KEY(OtherCatID) REFERENCES Categories(CategoryID)
- );
- create table Products(
- ProductID number(4),
- ProductName varchar2(40),
- CategoryID number(4),
- constraint pk_product primary key(ProductID),
- constraint fk_category foreign key(CategoryID) references Categories(CategoryID)
- );
- create table Properties(
- PropertyId number(4),
- PropertyName varchar2(40),
- PropertyValue varchar2(40),
- constraint pk_property primary key(PropertyID)
- );
- create table BindProductsProperties(
- ProductID number(4),
- PropertyID number(4),
- constraint fk_product foreign key(ProductID) references Products(ProductID),
- constraint fk_property foreign key(PropertyID) references Properties(PropertyID)
- );
- create table Clients(
- ClientID number(4),
- ClientName varchar2(40),
- ClientAddress varchar2(200),
- constraint pk_client primary key(ClientID)
- );
- create table Orders(
- OrderID number(4),
- ClientID number(4),
- RequestDate date,
- ConfirmationDate date,
- constraint pk_order primary key(OrderID),
- constraint fk_client foreign key(ClientID) references Clients(ClientID)
- );
- create table OrderedItems(
- OrderID number(4),
- ProductID number(4),
- Quantity number(4),
- constraint fk_order foreign key(OrderID) references Orders(OrderID),
- constraint fk_ordered_item foreign key(ProductID) references Products(ProductID)
- );
- create table Prices(
- ProductID number(4),
- StartDate date,
- EndDate date,
- Price number(6,2),
- constraint fk_price_product foreign key(ProductID) references Products(ProductID)
- );
- insert into Categories values (0,'PC',null);
- insert into Categories values (1,'Toys',null);
- insert into Categories values (2,'Luxury',null);
- insert into Categories values (3,'Clothes',null);
- insert into Clients values (0,'Giovanni Giordo','Timisoara');
- insert into Clients values (1,'Eric Thomas','Arad');
- insert into Clients values (2,'Catalin Popescu','Timisoara');
- insert into Clients values (3,'Maria Floreasca','Bucuresti');
- insert into Products values (0,'Laptop',0);
- insert into Products values (1,'Teddy Bear',1);
- insert into Products values (2,'Watch',2);
- insert into Products values (3,'Gloves',3);
- insert into Properties values (0,'Color','Black');
- insert into Properties values (1,'Color','Gold');
- insert into Properties values (2,'Brand','Calvin Klein');
- insert into Properties values (3,'Material','Wool');
- insert into BindProductsProperties values(0,0);
- insert into BindProductsProperties values(1,1);
- insert into BindProductsProperties values(2,2);
- insert into BindProductsProperties values(3,3);
- insert into Orders values (0,0,'15-NOV-16','26-NOV-16');
- insert into OrderedItems values (0,0,3);
- insert into Prices values (0,'15-NOV-2016','26-NOV-2016',114);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement