/ Published in: SQL

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
DROP TABLE IF EXISTS `products_tags`; DROP TABLE IF EXISTS `tags`; DROP TABLE IF EXISTS `products`; CREATE TABLE `products` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(100) NOT NULL, `price` DECIMAL(10,2) NOT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `tags` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(64) NOT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `products_tags` ( `product_id` INT(11) NOT NULL DEFAULT '0', `tag_id` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`product_id`,`tag_id`) )
Comments
