· 8 years ago · Jan 28, 2018, 10:20 PM
1create table if not exists Klient
2(
3 id_klient integer PRIMARY KEY,
4 imie text not null,
5 nazwisko text not null,
6 email text not null,
7 telefon integer not null,
8 adres text not null,
9 kod_pocztowy text not null
10
11);
12create table if not exists Produkt
13(
14 id_produkt integer PRIMARY KEY,
15 nazwa text not null,
16 cena money not null,
17 ilosc_magazyn integer not null
18);
19create table if not exists Zamowienie
20(
21 id_zamowienie integer PRIMARY KEY,
22 klientID integer not null,
23 data_zam date not null,
24 data_wys date not null,
25 status text not null,
26 koszykID integer not null
27);
28create table if not exists Koszyk
29(
30 id_koszyk integer PRIMARY KEY,
31 ilosc integer not null,
32 produktID integer not null
33);
34INSERT INTO Klient (id_klient, imie, nazwisko, email, telefon, adres, kod_pocztowy)
35VALUES ('1','Jan','Pawlik','janpaw@gmail.com',666333666,'Lodz ul.Gdanska 14','91-002'),
36('2','Adam','Kowalski','adkowa@gmail.com',123123123,'Lodz ul.Pomorska 20','92-024'),
37('3','Wiktoria','Kozieł','wikko@gmail.com',345123678,'Radom ul.Owocowa 18','89-023'),
38('4','Zuzanna','Lewandowska','zuzalewa@gmail.com',678243756,'Sosnowiec ul.Smutna 13','66-333'),
39('5','Robert','Witkowski','robwit@gmail.com',421543876,'Szczecin ul.Zamkowa 6','23-543');
40
41INSERT INTO Produkt (id_produkt, nazwa, cena, ilosc_magazyn)
42VALUES ('1','Witaminy',39.99,50),
43('2','Leki',14.99,30),
44('3','Ziola',49.99,10),
45('4','Zele',16.49,12),
46('5','Syropy',24.49,8);
47
48INSERT INTO Zamowienie (id_zamowienie, klientid, data_zam, data_wys, status, koszykid)
49VALUES ('1','3','1/2/2018','1/4/2018','Wyslane','3'),
50('2','4','10/1/2018','12/1/2018','Kompletowanie zamowienia','4'),
51('3','5','5/1/2018','7/1/2018','Wyslane','5'),
52('4','1','2/1/2018','4/1/2018','Wyslane','2'),
53('5','2','8/1/2018','10/1/2018','Wyslane','1');
54
55
56INSERT INTO Koszyk (id_koszyk, ilosc, produktid)
57VALUES ('1','2','3'),
58('2','3','2'),
59('3','5','1'),
60('4','2','5'),
61('5','3','4');