diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-05-05 19:34:39 +0200 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-05-05 19:34:39 +0200 |
| commit | 705c4cb50eea66585cc95c7314001fce9dd197cd (patch) | |
| tree | 4a448f4e30b117e12306b643121f49da15e6376b /catalog.sql | |
| download | Catalog-705c4cb50eea66585cc95c7314001fce9dd197cd.tar.gz Catalog-705c4cb50eea66585cc95c7314001fce9dd197cd.zip | |
Initial commit
Diffstat (limited to 'catalog.sql')
| -rw-r--r-- | catalog.sql | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/catalog.sql b/catalog.sql new file mode 100644 index 0000000..20598a2 --- /dev/null +++ b/catalog.sql @@ -0,0 +1,170 @@ +-- phpMyAdmin SQL Dump +-- version 4.4.4 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Erstellungszeit: 05. Mai 2015 um 17:57 +-- Server-Version: 10.0.17-MariaDB-log +-- PHP-Version: 5.6.8 + +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=4 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.'); + +-- -------------------------------------------------------- + +-- +-- 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=7 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.'); + +-- -------------------------------------------------------- + +-- +-- 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); + +-- -------------------------------------------------------- + +-- +-- 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=4; +-- +-- 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=7; +-- +-- 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`), + ADD CONSTRAINT `product_category_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`); + +/*!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 */; |
