Data Definition Language -- SQL text that will create the tables and indices
for an existing database.
I'm looking for a script that will look at an existing database and generate
this from the "show tables", "show columns" and "show indexes" for that
database.
Here's an old example:
/* Create iParty DB -*-sql-*-*/
/* $Id: make-sgdb.sql,v 1.2 1999/02/04 20:34:54 eberg Exp $ */
drop database if exists sgdb;
create database sgdb;
use sgdb;
drop table if exists STARS;
Create Table STARS
(
STAR_ID INT NOT NULL,
NAME varchar(80),
IMAGE varchar(255),
DESCRIPTION text,
PRIMARY KEY (STAR_ID)
);
drop table if exists STARS_TO_ATTRIBUTES;
Create Table STARS_TO_ATTRIBUTES
(
STAR_ID INT NOT NULL,
ATTRIBUTE_ID int NOT NULL,
Primary Key (STAR_ID, ATTRIBUTE_ID)
);
drop table if exists SG_ATTRIBUTES;
Create Table SG_ATTRIBUTES
(
ID INT NOT NULL,
NAME VARCHAR(128),
TYPE VARCHAR(20),
primary key (ID)
);
drop table if exists SG_MESSAGES;
Create Table SG_MESSAGES
(
ID INT NOT NULL,
SG_SKU varchar(30) NOT NULL,
IPARTY_SKU varchar(30) NOT NULL,
STAR_ID INT NOT NULL,
TITLE VARCHAR(255),
SHORT_DESC VARCHAR(255),
LONG_DESC text,
primary key(ID),
UNIQUE iparty_SKU (IPARTY_SKU),
UNIQUE sg_SKU (SG_SKU)
);
-Eric.
Sys Adm 89806 Manager of programing development and Intranet Resources: [Tuesday
30-March]:
> What are DDL?
>
>
> Ruben
>