From 0a51d468632181c757b9cdeec162cd42385c93b5 Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Mon, 18 May 2015 13:04:30 +0200 Subject: Update the catalog.swl structure und add new data sets --- catalog.sql | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'catalog.sql') diff --git a/catalog.sql b/catalog.sql index 20598a2..fbd584d 100644 --- a/catalog.sql +++ b/catalog.sql @@ -1,11 +1,11 @@ -- phpMyAdmin SQL Dump --- version 4.4.4 +-- version 4.4.6.1 -- 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 +-- 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"; @@ -30,7 +30,7 @@ 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; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -- -- Daten für Tabelle `category` @@ -39,7 +39,8 @@ CREATE TABLE IF NOT EXISTS `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.'); +(3, 'Vehicles', 'Everything from one to a million wheels.'), +(4, 'Misc', 'Different things for different people.'); -- -------------------------------------------------------- @@ -54,7 +55,7 @@ CREATE TABLE IF NOT EXISTS `product` ( `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; +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; -- -- Daten für Tabelle `product` @@ -66,7 +67,9 @@ INSERT INTO `product` (`id`, `name`, `price`, `width`, `height`, `description`) (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.'); +(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.'); -- -------------------------------------------------------- @@ -89,7 +92,9 @@ INSERT INTO `product_category` (`product_id`, `category_id`) VALUES (3, 1), (4, 2), (5, 3), -(6, 3); +(6, 3), +(7, 4), +(8, 4); -- -------------------------------------------------------- @@ -148,12 +153,12 @@ ALTER TABLE `user` -- 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; + 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=7; + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'The primary key for the table.',AUTO_INCREMENT=21; -- -- Constraints der exportierten Tabellen -- @@ -162,8 +167,8 @@ ALTER TABLE `product` -- 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`); + 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 */; -- cgit v1.2.3-70-g09d2