init-commit

This commit is contained in:
Cezary Pukownik 2019-06-10 12:19:10 +02:00
commit 802e826748
3 changed files with 6272 additions and 0 deletions

6195
PizzaFat.pdf Normal file

File diff suppressed because it is too large Load Diff

77
PizzaFat.sql Normal file
View File

@ -0,0 +1,77 @@
CREATE TABLE 'zamowienia'
(
'id' int PRIMARY KEY,
'date' datetime,
'id_faktury' int,
'id_klienta' int
);
CREATE TABLE 'zamowienia_wiersze'
(
'id' int PRIMARY KEY,
'order_id' int,
'pizza_id' int,
'ilosc' int,
'cena' double,
'kwota' double
);
CREATE TABLE 'pizze'
(
'id' int PRIMARY KEY,
'name' varchar(255),
'price' int
);
CREATE TABLE 'pizze_przepisy'
(
'pizza_id' int,
'skladnik_id' int,
'ilosc' double,
'koszt' double,
'kwota_kosztu' double
);
CREATE TABLE 'skladniki'
(
'id' int PRIMARY KEY,
'name' varchar(255),
'cena' double
);
CREATE TABLE 'sladniki_transakcje'
(
'id' int PRIMARY KEY,
'data' datetime,
'skladnik_id' int,
'zamowienie_wiersz_id' int,
'ilosc' double,
'koszt' double,
'cena' double,
'kwota_kosztu' double,
'kwota_sprzedazy' double,
'zysk' double
);
CREATE TABLE 'zakupy'
(
'id' int PRIMARY KEY,
'id_faktury' int,
'skladnik_id' int,
'ilosc' double,
'koszt' double
);
ALTER TABLE 'zamowienia_wiersze' ADD FOREIGN KEY ('order_id') REFERENCES 'zamowienia' ('id');
ALTER TABLE 'zamowienia_wiersze' ADD FOREIGN KEY ('pizza_id') REFERENCES 'pizze' ('id');
ALTER TABLE 'pizze_przepisy' ADD FOREIGN KEY ('pizza_id') REFERENCES 'pizze' ('id');
ALTER TABLE 'pizze_przepisy' ADD FOREIGN KEY ('skladnik_id') REFERENCES 'skladniki' ('id');
ALTER TABLE 'sladniki_transakcje' ADD FOREIGN KEY ('skladnik_id') REFERENCES 'skladniki' ('id');
ALTER TABLE 'sladniki_transakcje' ADD FOREIGN KEY ('zamowienie_wiersz_id') REFERENCES 'zamowienia_wiersze' ('id');
ALTER TABLE 'zakupy' ADD FOREIGN KEY ('skladnik_id') REFERENCES 'skladniki' ('id');

0
README.nd Normal file
View File