All pastes #250320 Raw Edit

nox

public text v1 · immutable
#250320 ·published 2006-11-16 21:25 UTC
rendered paste body
DROP DATABASE IF EXISTS `Magasin`;
CREATE DATABASE `Magasin`;
USE `Magasin`;

DROP TABLE IF EXISTS `T_Categories`;
CREATE TABLE `T_Categories` (
  `Cat_No` INT NOT NULL AUTO_INCREMENT,
  `Cat_Nom` VARCHAR(20) NOT NULL,
  PRIMARY KEY (`Cat_No`),
  UNIQUE `UQ__T_Categories__7D78A4E7` (`Cat_No`)
) TYPE=InnoDB;

LOCK TABLES `T_Categories` WRITE;
INSERT INTO `T_Categories` VALUES(1000, 'Curling');
INSERT INTO `T_Categories` VALUES(1001, 'Patin');
INSERT INTO `T_Categories` VALUES(1002, 'Snowboard');
INSERT INTO `T_Categories` VALUES(1003, 'Peche');
INSERT INTO `T_Categories` VALUES(1004, 'Raquette');
insert into `T_Categories` VALUES(1005, 'Football');
UNLOCK TABLES;

DROP TABLE IF EXISTS `T_Produits`;
CREATE TABLE `T_Produits` (
  `Pro_No` INT NOT NULL AUTO_INCREMENT,
  `Pro_Nom` VARCHAR(50) NOT NULL,
  `Pro_Qte` INT NOT NULL,
  `Pro_Prix` FLOAT NOT NULL,
  `Cat_No` INT NOT NULL References  T_Categories(Cat_No),
  PRIMARY KEY (`Pro_No`),
  UNIQUE `UQ__T_Produits__00551192` (`Pro_No`)
) TYPE=InnoDB;

LOCK TABLES `T_Produits` WRITE;
INSERT INTO `T_Produits` VALUES (1000, 'Balai Transformer 8-ender', 34, 7.399000e+001, 1000);
INSERT INTO `T_Produits` VALUES (1001, 'Chaussures de curling Asham', 12, 8.999000e+001, 1000);
INSERT INTO `T_Produits` VALUES (1002, 'Patin Senior Bauer Vapor Pro', 16, 2.199900e+002, 1001);
INSERT INTO `T_Produits` VALUES (1003, 'Patin Mission Pure C4', 49, 1.999900e+002, 1001);
INSERT INTO `T_Produits` VALUES (1004, 'Patin Easton Synergy, homme', 34, 1.999900e+002, 1001);
insert into `T_Produits` VALUES (1005,'Patins Nike Q4 pour juniors',58,139.99,1001);
insert into `T_Produits` VALUES (1006,'Patin Bauer Vapor Pro',19,159.99,1001);
insert into `T_Produits` VALUES (1007,'Planche à neige Pro 145',14,159.99,1002);
insert into `T_Produits` VALUES (1008,'Bottes pour planche à neige',37,79.99,1002);
insert into `T_Produits` VALUES (1009,'Planche à neige Echos 144 H2O',24,58.99,1002);
insert into `T_Produits` VALUES (1010,'Canne à lancer, série Izumi',44,79.99,1003);
insert into `T_Produits` VALUES (1011,'Canne à lancer léger Shimano Convergence',17,69.99,1003);
insert into `T_Produits` VALUES (1012,'Canne Rhino en 3 pièces, 5 pi',27,28.99,1003);
insert into `T_Produits` VALUES (1013,'Raquettes Tubbs, 36 po',14,279.99,1004);
insert into `T_Produits` VALUES (1014,'Raquettes Tubbs Adventure',24,239.99,1004);
insert into `T_Produits` VALUES (1015,'Raquettes Atlas en aluminium',32,199.99,1004);
insert into `T_Produits` VALUES (1016,'Bâtons réglables pour raquettes Atlas',90,64.99,1004);
insert into `T_Produits` VALUES (1017,'Bâtons Poweridge, 2 pces',46,59.99,1004);
insert into `T_Produits` VALUES (1018,'Fixations de raquettes',48,22.99,1004);
insert into `T_Produits` VALUES (1019,'Ballon de football Nike Cage Grip',18,34.99,1005);
insert into `T_Produits` VALUES (1020,'Ballon de football Wilson NFL en composite',30,29.99,1005);
insert into `T_Produits` VALUES (1021,'Ballon de football Nike 1000',4,29.99,1005);
insert into `T_Produits` VALUES (1022,'Ballon de football Wilson',17,15.99,1005);
UNLOCK TABLES;

SET FOREIGN_KEY_CHECKS = 0;
ALTER TABLE `T_Produits` ADD INDEX (`Cat_No`);
ALTER TABLE `T_Produits` ADD CONSTRAINT `FK_Categorie_IDe001` FOREIGN KEY(`Cat_No`) REFERENCES `T_Produits`(`Pro_No`);
SET FOREIGN_KEY_CHECKS = 1;