This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 23rd, 2012  |  syntax: SQL  |  size: 2.09 KB  |  views: 39  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
  2. SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
  3. SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
  4.  
  5. CREATE SCHEMA IF NOT EXISTS `items` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
  6. USE `items` ;
  7.  
  8. -- -----------------------------------------------------
  9. -- Table `items`.`price`
  10. -- -----------------------------------------------------
  11. CREATE  TABLE IF NOT EXISTS `items`.`price` (
  12.   `idPrice` INT NOT NULL AUTO_INCREMENT ,
  13.   `price` INT(6) NOT NULL ,
  14.   `type` VARCHAR(16) NOT NULL ,
  15.   `shop` VARCHAR(250) NULL ,
  16.   PRIMARY KEY (`idPrice`) )
  17. ENGINE = InnoDB;
  18.  
  19.  
  20. -- -----------------------------------------------------
  21. -- Table `items`.`coords`
  22. -- -----------------------------------------------------
  23. CREATE  TABLE IF NOT EXISTS `items`.`coords` (
  24.   `idCoords` INT NOT NULL AUTO_INCREMENT ,
  25.   `s_coords` VARCHAR(7) NOT NULL ,
  26.   `f_coords` VARCHAR(7) NOT NULL ,
  27.   `se_coords` VARCHAR(7) NULL ,
  28.   `fe_coords` VARCHAR(7) NULL ,
  29.   `col_seq` VARCHAR(18) NOT NULL ,
  30.   PRIMARY KEY (`idCoords`) )
  31. ENGINE = InnoDB;
  32.  
  33.  
  34. -- -----------------------------------------------------
  35. -- Table `items`.`items`
  36. -- -----------------------------------------------------
  37. CREATE  TABLE IF NOT EXISTS `items`.`items` (
  38.   `idItems` INT NOT NULL AUTO_INCREMENT ,
  39.   `name` VARCHAR(1000) NOT NULL ,
  40.   `i_type` VARCHAR(11) NOT NULL ,
  41.   `o_type` VARCHAR(250) NOT NULL ,
  42.   `price_idPrice` INT NULL ,
  43.   `coords_idCoords` INT NOT NULL ,
  44.   PRIMARY KEY (`idItems`) ,
  45.   INDEX `fk_items_price` (`price_idPrice` ASC) ,
  46.   INDEX `fk_items_coords1` (`coords_idCoords` ASC) ,
  47.   CONSTRAINT `fk_items_price`
  48.     FOREIGN KEY (`price_idPrice` )
  49.     REFERENCES `items`.`price` (`idPrice` )
  50.     ON DELETE NO ACTION
  51.     ON UPDATE NO ACTION,
  52.   CONSTRAINT `fk_items_coords1`
  53.     FOREIGN KEY (`coords_idCoords` )
  54.     REFERENCES `items`.`coords` (`idCoords` )
  55.     ON DELETE NO ACTION
  56.     ON UPDATE NO ACTION)
  57. ENGINE = InnoDB;
  58.  
  59.  
  60.  
  61. SET SQL_MODE=@OLD_SQL_MODE;
  62. SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  63. SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
clone this paste RAW Paste Data