All pastes #55387 Raw Edit

SQL

public sql v1 · immutable
#55387 ·published 2006-05-12 12:35 UTC
rendered paste body
/*==============================================================*//* DBMS name:      MySQL 5.0                                    *//* Created on:     21/03/2006 18:11:39                          *//*==============================================================*/drop table if exists junks;drop table if exists tagmaps;drop table if exists tags;create table junks(	id	int not null auto_increment,	name	varchar(255) not null,	primary key (id))type = InnoDB;create table tagmaps(	id		int not null auto_increment,	junk_id	int not null,	tag_id int not null,	primary key (id))type = InnoDB;create table tags(	id	int not null auto_increment,	name	varchar(255) not null,	primary key (id))type = InnoDB;alter table tagmaps add constraint fk_for_junk foreign key (junk_id)      references junks(id) on delete restrict on update restrict;alter table tagmaps add constraint fk_tag foreign key (tag_id)      references tags(id) on delete restrict on update restrict;