SHOW:
|
|
- or go back to the newest paste.
1 | CREATE TABLE Cards | |
2 | (id integer identity(1,1) primary key, | |
3 | name varchar(30), | |
4 | indeks varchar(20) unique ); | |
5 | ||
6 | insert into Cards values ('SUROWIEC','OryginalnyIndex1') | |
7 | insert into Cards values ('BUTELKA','OryginalnyIndex2') | |
8 | insert into Cards values ('KAPSLE','OryginalnyIndex3') | |
9 | insert into Cards values ('ETYKIETA','OryginalnyIndex4') | |
10 | insert into Cards values ('MATERIAŁY_MARKETINGOWE','OryginalnyIndex5') | |
11 | insert into Cards values ('KARTON','OryginalnyIndex6') | |
12 | insert into Cards values ('PALETA','OryginalnyIndex7') | |
13 | insert into Cards values ('ETYKIETA','OryginalnyIndex8') | |
14 | insert into Cards values ('DODATKOWE_ELEMENTY','OryginalnyIndex9') | |
15 | insert into Cards values ('WYROB_GOTOWY','OryginalnyIndex10') | |
16 | insert into Cards values ('PLYN','OryginalnyIndex11') | |
17 | insert into Cards values ('BARWNIK','OryginalnyIndex12') | |
18 | insert into Cards values ('KRATKA','OryginalnyIndex13') | |
19 | insert into Cards values ('WYROB_KONFEKCJONOWANY','OryginalnyIndex14') | |
20 | insert into Cards values ('INNY_RODZAJ_ZAMKNIECIA','OryginalnyIndex15') | |
21 | ||
22 | CREATE TABLE Specifications | |
23 | (id integer identity(1,1) primary key, | |
24 | name varchar(30), | |
25 | id_card integer, | |
26 | type varchar(10) ); | |
27 | ||
28 | alter table Specifications | |
29 | add constraint id_card_fk1 foreign key (id_card) references Cards(id) | |
30 | ||
31 | insert into Specifications values('GESTOSC',1,'LICZBA') | |
32 | insert into Specifications values('ALERGRNY1',1,'TEKST') | |
33 | insert into Specifications values('ALERGENY2',1,'TEKST') | |
34 | insert into Specifications values('ALERGENY3',1,'TEKST') | |
35 | insert into Specifications values('ETYKIETOWANIE',1,'LICZBA') | |
36 | insert into Specifications values('GMO',1,'YESNO') | |
37 | insert into Specifications values('WYMIARY',2,'TEKST') | |
38 | insert into Specifications values('WAGA',2,'TEKST') | |
39 | insert into Specifications values('RYSUNEK',2,'TEKST') | |
40 | insert into Specifications values('KOD_KRESKOWY',2,'LICZBA') | |
41 | insert into Specifications values('WYMIARY',3,'TEKST') | |
42 | insert into Specifications values('WAGA',3,'LICZBA') | |
43 | insert into Specifications values('INDEKS',3,'TEKST') | |
44 | insert into Specifications values('WAGA',4,'LICZBA') | |
45 | insert into Specifications values('INDEKS',4,'TEKST') | |
46 | insert into Specifications values('RODZAJ_SUROWCA',5,'TEKST') | |
47 | insert into Specifications values('INDEKS',5,'TEKST') | |
48 | insert into Specifications values('KOD_KRESKOWY',6,'LICZBA') | |
49 | insert into Specifications values('RODZAJ_SUROWCA',6,'TEKST') | |
50 | insert into Specifications values('INDEKS',6,'TEKST') | |
51 | insert into Specifications values('RODZJA_PALETY',7,'TEKST') | |
52 | insert into Specifications values('WAGA',7,'LICZBA') | |
53 | insert into Specifications values('INDEKS',7,'TEKST') | |
54 | insert into Specifications values('WYMIARY',7,'TEKST') | |
55 | insert into Specifications values('ZGRZEWKI',10,'LICZBA') | |
56 | insert into Specifications values('TOLERANCJA',10,'LICZBA') | |
57 | insert into Specifications values('NAPELNIENIE',10,'TEKST') | |
58 | insert into Specifications values('OPIS_PROMOCJI',10,'TEKST') | |
59 | insert into Specifications values('PELNA_NAZWA',10,'TEKST') | |
60 | insert into Specifications values('GESTOSC',11,'TEKST') | |
61 | insert into Specifications values('FILTRACJA',11,'TEKST') | |
62 | insert into Specifications values('WYGLAD',11,'TEKST') | |
63 | insert into Specifications values('UWAGI',11,'TEKST') | |
64 | insert into Specifications values('ZBIORNIKI',11,'TEKST') | |
65 | insert into Specifications values('NAZWA',12,'TEKST') | |
66 | insert into Specifications values('KOD_E-XXX',12,'TEKST') | |
67 | insert into Specifications values('NAZWA',13,'TEKST') | |
68 | insert into Specifications values('WAGA',13,'LICZBA') | |
69 | insert into Specifications values('INDEKS',13,'TEKST') | |
70 | insert into Specifications values('OPIS',14,'TEKST') | |
71 | insert into Specifications values('NAZWA',14,'LICZBA') | |
72 | insert into Specifications values('MOC',14,'LICZBA') | |
73 | insert into Specifications values('INDEKS',14,'TEKST') | |
74 | insert into Specifications values('WAGA',15,'LICZBA') | |
75 | ||
76 | CREATE TABLE CardsData | |
77 | (id integer identity(1,1) primary key, | |
78 | id_card integer, | |
79 | name varchar(20) ); | |
80 | ||
81 | alter table CardsData | |
82 | add constraint id_card_fk2 foreign key (id_card) references Cards(id) | |
83 | ||
84 | CREATE TABLE SpecificationsData | |
85 | (id integer identity(1,1) primary key, | |
86 | id_cardData integer, | |
87 | id_specification integer, | |
88 | number_value float(10), | |
89 | text_value varchar(20), | |
90 | yesno_value bit); | |
91 | ||
92 | alter table SpecificationsData | |
93 | add constraint id_cardData_fk1 foreign key (id_cardData) references CardsData(id) | |
94 | alter table SpecificationsData | |
95 | add constraint id_specification_fk foreign key (id_specification) references Specifications(id) | |
96 | ||
97 | CREATE TABLE Structure( | |
98 | id integer identity(1,1) primary key, | |
99 | id_cardStructure integer, | |
100 | id_card integer); | |
101 | ||
102 | ALTER TABLE Structure | |
103 | add constraint id_card_fk3 foreign key (id_cardStructure) references Cards(id) | |
104 | ALTER TABLE Structure | |
105 | add constraint id_card_fk4 foreign key (id_card) references Cards(id) | |
106 | ||
107 | CREATE TABLE StructureData( | |
108 | id integer identity(1,1) primary key, | |
109 | id_cardDataStructure integer, | |
110 | id_structure integer, | |
111 | id_cardData integer); | |
112 | ||
113 | ALTER TABLE StructureData | |
114 | add constraint id_cardData_fk2 foreign key (id_cardDataStructure) references CardsData(id) | |
115 | ALTER TABLE StructureData | |
116 | add constraint id_cardData_fk3 foreign key (id_cardData) references CardsData(id) | |
117 | ALTER TABLE StructureData | |
118 | - | add constraint id_structure foreign key (id_structure) references Structure(id) |
118 | + | add constraint id_structure foreign key (id_structure) references Structure(id) |
119 | ||
120 | insert into Structure values (10,2) | |
121 | insert into Structure values (10,3) | |
122 | insert into Structure values (10,4) | |
123 | insert into Structure values (10,8) | |
124 | insert into Structure values (10,8) | |
125 | insert into Structure values (10,8) | |
126 | insert into Structure values (10,6) | |
127 | insert into Structure values (10,7) | |
128 | insert into Structure values (10,11) | |
129 | ||
130 | insert into Structure values (14,10) | |
131 | insert into Structure values (14,6) | |
132 | insert into Structure values (14,7) | |
133 | insert into Structure values (14,13) | |
134 | insert into Structure values (14,8) | |
135 | insert into Structure values (14,9) | |
136 | insert into Structure values (14,5) |