SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `rsmad` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `rsmad` ;
-- -----------------------------------------------------
-- Table `rsmad`.`app_flashobjects`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `rsmad`.`app_flashobjects` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`app_id` INT UNSIGNED NOT NULL ,
`flashobject_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `rsmad`.`app_html`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `rsmad`.`app_html` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`app_id` INT UNSIGNED NOT NULL ,
`html_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `rsmad`.`app_iframes`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `rsmad`.`app_iframes` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`app_id` INT UNSIGNED NOT NULL ,
`iframe_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `rsmad`.`app_images`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `rsmad`.`app_images` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`app_id` INT UNSIGNED NOT NULL ,
`image_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `rsmad`.`app_links`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `rsmad`.`app_links` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`app_id` INT UNSIGNED NOT NULL ,
`link_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `rsmad`.`app_text`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `rsmad`.`app_text` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`app_id` INT UNSIGNED NOT NULL ,
`text_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `rsmad`.`apps`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `rsmad`.`apps` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`webpage_id` INT UNSIGNED NOT NULL ,
`timestamp` DATETIME NULL ,
`status` ENUM('ok','malicious','good') NOT NULL DEFAULT 'ok' ,
PRIMARY KEY (`id`) ,
CONSTRAINT `fk_apps_app_flashobjects1`
FOREIGN KEY (`id` )
REFERENCES `rsmad`.`app_flashobjects` (`app_id` )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_apps_app_html1`
FOREIGN KEY (`id` )
REFERENCES `rsmad`.`app_html` (`app_id` )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_apps_app_iframes1`
FOREIGN KEY (`id` )
REFERENCES `rsmad`.`app_iframes` (`app_id` )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_apps_app_images1`
FOREIGN KEY (`id` )
REFERENCES `rsmad`.`app_images` (`app_id` )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_apps_app_links1`
FOREIGN KEY (`id` )
REFERENCES `rsmad`.`app_links` (`app_id` )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_apps_app_text1`
FOREIGN KEY (`id` )
REFERENCES `rsmad`.`app_text` (`app_id` )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
これらのクエリの問題を説明できる人はいますか?