Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE IF NOT EXISTS `categories` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
- `name` VARCHAR(20) NOT NULL ,
- PRIMARY KEY (`id`) )
- ENGINE = InnoDB;
- CREATE TABLE IF NOT EXISTS `events` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
- `title` VARCHAR(30) NOT NULL ,
- PRIMARY KEY (`event_id`))
- ENGINE = InnoDB;
- CREATE TABLE IF NOT EXISTS `eventcategories` (
- `event_id` INT UNSIGNED NOT NULL ,
- `category_id` INT UNSIGNED NOT NULL ,
- INDEX `ecevent` (`event_id` ASC) ,
- INDEX `eccategory` (`category_id` ASC) ,
- CONSTRAINT `ecevent`
- FOREIGN KEY (`event_id` )
- REFERENCES `events` (`id` )
- ON DELETE CASCADE
- ON UPDATE CASCADE,
- CONSTRAINT `eccategory`
- FOREIGN KEY (`category_id` )
- REFERENCES `categories` (`id` )
- ON DELETE RESTRICT
- ON UPDATE CASCADE)
- ENGINE = InnoDB;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement