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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
-- phpMyAdmin SQL Dump
-- version 4.4.6.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Erstellungszeit: 18. Mai 2015 um 11:01
-- Server-Version: 10.0.18-MariaDB-log
-- PHP-Version: 5.6.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Datenbank: `catalog`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `category`
--
CREATE TABLE IF NOT EXISTS `category` (
`id` int(11) NOT NULL COMMENT 'The primary key of the category.',
`name` varchar(100) NOT NULL COMMENT 'The name of the category.',
`description` varchar(1000) DEFAULT NULL COMMENT 'The description of the category.'
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
--
-- Daten für Tabelle `category`
--
INSERT INTO `category` (`id`, `name`, `description`) VALUES
(1, 'Furniture', 'All kind of different furniture and the like.'),
(2, 'Fruits', 'Juicy and delicious fruits.'),
(3, 'Vehicles', 'Everything from one to a million wheels.'),
(4, 'Misc', 'Different things for different people.');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `product`
--
CREATE TABLE IF NOT EXISTS `product` (
`id` int(11) NOT NULL COMMENT 'The primary key for the table.',
`name` varchar(100) NOT NULL COMMENT 'The name of the product.',
`price` decimal(10,2) NOT NULL COMMENT 'The price of the product in euro (VAT included).',
`width` int(11) NOT NULL COMMENT 'The width of the product in millimeter.',
`height` int(11) NOT NULL COMMENT 'The height of the product in millimeter.',
`description` varchar(1000) DEFAULT NULL COMMENT 'The description of the product.'
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
--
-- Daten für Tabelle `product`
--
INSERT INTO `product` (`id`, `name`, `price`, `width`, `height`, `description`) VALUES
(1, 'Chair', '20.00', 500, 500, 'A chair you can sit in, maybe. Quite comfy, I guess. Probably made of wood or a wood like material.'),
(2, 'Banana', '0.59', 40, 150, 'A long yellow fruit.'),
(3, 'Table', '30.00', 1000, 700, 'A good place for your computer or laptop.'),
(4, 'Apple', '0.31', 100, 100, 'A red or green fruit. Mostly to expensive.'),
(5, 'Motorbike', '1060.32', 1500, 750, 'A car, but only with two wheels and no roof.'),
(6, 'Monstertruck', '5001.10', 3000, 5000, 'Vroom and death.'),
(7, 'Hipster-Hat', '2000.00', 100, 100, 'Now you can wear it before it becomes cool.'),
(8, 'Bling Bling Necklace', '1000.00', 2000, 2000, 'A very shiny necklace for very rich people.');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `product_category`
--
CREATE TABLE IF NOT EXISTS `product_category` (
`product_id` int(11) NOT NULL COMMENT 'The product_id from the product table.',
`category_id` int(11) NOT NULL COMMENT 'The category_id from the category table.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Daten für Tabelle `product_category`
--
INSERT INTO `product_category` (`product_id`, `category_id`) VALUES
(1, 1),
(2, 2),
(3, 1),
(4, 2),
(5, 3),
(6, 3),
(7, 4),
(8, 4);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`username` varchar(100) NOT NULL COMMENT 'The username of the user.',
`password` char(40) NOT NULL COMMENT 'The password of the user. (sha-1)',
`salt` char(20) NOT NULL COMMENT 'A 20 char salt for the password.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Daten für Tabelle `user`
--
INSERT INTO `user` (`username`, `password`, `salt`) VALUES
('admin', '380dca0ecae4f9eaa1ae5aba87dbf4b9003487cd', 's7nXfQhMXQ9hmNqRT3eT'),
('stefan', 'fafc76665a8a3ac9d13a4367ff6a0820a6aff4d2', '5zNZdAtU77n7CDmPcbxH');
--
-- Indizes der exportierten Tabellen
--
--
-- Indizes für die Tabelle `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`id`);
--
-- Indizes für die Tabelle `product`
--
ALTER TABLE `product`
ADD PRIMARY KEY (`id`);
--
-- Indizes für die Tabelle `product_category`
--
ALTER TABLE `product_category`
ADD PRIMARY KEY (`product_id`,`category_id`),
ADD KEY `category_id` (`category_id`);
--
-- Indizes für die Tabelle `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`username`);
--
-- AUTO_INCREMENT für exportierte Tabellen
--
--
-- AUTO_INCREMENT für Tabelle `category`
--
ALTER TABLE `category`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'The primary key of the category.',AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT für Tabelle `product`
--
ALTER TABLE `product`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'The primary key for the table.',AUTO_INCREMENT=21;
--
-- Constraints der exportierten Tabellen
--
--
-- Constraints der Tabelle `product_category`
--
ALTER TABLE `product_category`
ADD CONSTRAINT `product_category_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `product_category_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|