-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMagazynBazaSkrypt.sql
65 lines (52 loc) · 1.99 KB
/
MagazynBazaSkrypt.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
DROP DATABASE Magazyn
CREATE DATABASE Magazyn
USE Magazyn
CREATE TABLE [dbo].[DaneLogowania](
[ID] [int] PRIMARY KEY IDENTITY,
[Login] [nvarchar] (50) NOT NULL,
[Haslo] [nvarchar] (50) NOT NULL)
CREATE TABLE [dbo].[StanMagazynu](
[ID] [int] PRIMARY KEY IDENTITY,
[Nazwa] [nvarchar] (50) NOT NULL,
[Rodzaj] [nvarchar] (100) NOT NULL,
[PuszkaButelka] [nvarchar] (20) NULL,
[Ilosc] [int] NOT NULL)
CREATE TABLE [dbo].[Dostawcy](
[ID] [int] PRIMARY KEY IDENTITY,
[Nazwa] [nvarchar] (50) NOT NULL,
[Miasto] [nvarchar] (250) NOT NULL,
[Telefon] [nvarchar] (20) NOT NULL,
[Email] [nvarchar] (250) NOT NULL)
CREATE TABLE [dbo].[StatusDostawy](
[ID] [int] PRIMARY KEY IDENTITY,
[Nazwa] [nvarchar] (20) NOT NULL)
CREATE TABLE [dbo].[Dostawy](
[ID] [int] PRIMARY KEY IDENTITY,
[PiwoID] [int] NOT NULL FOREIGN KEY REFERENCES StanMagazynu(ID),
[DostawcaID] [int] NOT NULL FOREIGN KEY REFERENCES Dostawcy(ID),
[DataZamowienia] [datetime] NOT NULL,
[Ilosc] [int] NOT NULL,
[StatusID] [int] NOT NULL FOREIGN KEY REFERENCES StatusDostawy(ID))
INSERT INTO DaneLogowania VALUES
('login', 'haslo')
INSERT INTO StanMagazynu VALUES
('Atak Chmielu', 'American IPA', 'Puszka', 10),
('Pierwsza Pomoc', 'Polski PILS', 'Butelka', 15),
('Bawarka', 'Hefeweizen', 'Butelka', 20),
('Modern Drinking', 'West Coast IPA', 'Puszka', 25),
('Hazy Morning', 'American Pale IPA', 'Butelka', 30)
INSERT INTO Dostawcy VALUES
('FifiHurt', 'Zywiec', '665789763', '[email protected]'),
('SeBrowar', 'Krakow', '786543123', '[email protected]'),
('HurTom', 'Warszawa', '589654123', '[email protected]'),
('DobryBrowar', 'Mszana', '678901345', '[email protected]'),
('Chmielski', 'Kraków', '578900112', '[email protected]')
INSERT INTO StatusDostawy VALUES
('Przyjeta'),
('Realizowana')
INSERT INTO Dostawy VALUES
(1, 1, '2022-06-05', 10, 1),
(2, 2, '2022-06-05', 15, 1),
(3, 3, '2022-06-05', 20, 1),
(4, 4, '2022-06-05', 25, 1),
(5, 5, '2022-06-05', 30, 1)