?

Log in

The begenings of a database Obv, there aren't enough tables of… - Online Creativness [entries|archive|friends|userinfo]
Online Creativness

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

[Aug. 1st, 2002|09:29 pm]
Online Creativness

online_create

[tmtl]
[mood |boredbored]

The begenings of a database

Obv, there aren't enough tables of typename yet

use online_create;

DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS types;
DROP TABLE IF EXISTS stories;

CREATE TABLE users (
user_ID SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT DEFAULT '0',
username VARCHAR(20) UNIQUE,
firstname VARCHAR(20),
lastname VARCHAR(20),
password VARCHAR(15),
account_type TINYINT UNSIGNED NOT NULL DEFAULT '1',
email VARCHAR (20),
dob DATE DEFAULT '2002-08-01',
confirmation VARCHAR (10),
confirmed ENUM ('y','n') DEFAULT 'n',
deleted ENUM('y','n') DEFAULT 'n'
);

CREATE TABLE types (
type_ID SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT DEFAULT '0',
typename VARCHAR(20) NOT NULL DEFAULT 'Empty data type'
);

CREATE TABLE stories (
story_ID SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT DEFAULT '0',
user_ID SMALLINT UNSIGNED NOT NULL DEFAULT '0',
security_type ENUM ('Public','Logged-In','Private') NOT NULL DEFAULT 'Public',
story_title VARCHAR(40),
story_text text,
story_written_by VARCHAR(40),
story_deleted ENUM('y','n') NOT NULL DEFAULT 'n',
story_a_comments ENUM('y','n') NOT NULL DEFAULT 'n',
story_num_comments TINYINT DEFAULT '0'
);

INSERT INTO users VALUES ('','BenQuick','Ben','Quick','password123','','ben@domain.com','1983-01-05','cOnFiRmEd','y','n');
INSERT INTO users VALUES ('','TMTL','Ben','Quick','p123','','ben@domain.co.uk','1983-01-05','passed','y','n');
INSERT INTO types VALUES ('','Stories');
INSERT INTO types VALUES ('','Lyrics');
INSERT INTO types VALUES ('','Poems');
INSERT INTO stories VALUES ('','1','','TITLE','My story...','Ben Quick','','','');
linkReply