Back to the Data Model.
-- ============================================================
-- Application : Tutorials
-- DBMS name : MySQL
-- Created on : 9th. December 2001
-- ============================================================
-- ============================================================
-- Table: Images
-- ============================================================
CREATE TABLE images
(
image_id int(11) DEFAULT '0' NOT NULL auto_increment,
image_short_name VARCHAR(20) null ,
image_alt_text VARCHAR(255) null ,
image_url VARCHAR(255) null ,
primary key (image_id),
unique image_id_index (image_id)
)
/
-- ============================================================
-- Table: Tutorials
-- ============================================================
CREATE TABLE tutorials
(
tutorial_code CHAR(10) not null,
tutorial_url VARCHAR(255) null ,
tutorial_name VARCHAR(50) null ,
tutorial_description VARCHAR(255) null ,
unique tutorial_code_index (tutorial_code)
)
/
-- ============================================================
-- Table: Chapters
-- ============================================================
CREATE TABLE chapters
(
chapter_number INTEGER not null,
tutorial_code CHAR(10) not null,
chapter_url VARCHAR(255) null ,
chapter_title VARCHAR(255) null ,
chapter_description VARCHAR(2000) null ,
primary key (chapter_number),
unique chapter_number_index (chapter_number)
)
/
-- ============================================================
-- Table: Sections
-- ============================================================
CREATE TABLE sections
(
section_id int(11) DEFAULT '0' NOT NULL auto_increment,
chapter_number INTEGER not null,
section_code CHAR(10) null ,
section_sequence INTEGER null ,
section_url VARCHAR(255) null ,
section_name VARCHAR(255) null ,
section_description LONG null ,
primary key (section_id),
unique section_id_index (section_id)
)
/
-- ============================================================
-- Table: Paragraphs
-- ============================================================
CREATE TABLE paragraphs
(
paragraph_id int(11) DEFAULT '0' NOT NULL auto_increment,
section_id INTEGER not null,
paragraph_code CHAR(10) null ,
paragraph_sequence INTEGER null ,
paragraph_url VARCHAR(255) null ,
paragraph_header VARCHAR(255) null ,
paragraph_content TEXT null ,
primary key (paragraph_id),
UNIQUE PK_PARAGRAPHS (paragraph_id)
)
/
-- ============================================================
-- Table: Images_in_Paragraphs
-- ============================================================
CREATE TABLE images_in_paragraphs
(
paragraph_id INTEGER not null,
image_id INTEGER not null,
image_alignment_text VARCHAR(10) null ,
primary key (paragraph_id, image_id),
UNIQUE PK_IMAGES_IN_PARAGRAPHS (paragraph_id, image_id))/
Barry Williams
Principal Consultant
Database Answers