Internet Application Dev Lectures <- IAD Lectures <- Sean Forman <- You Are Here
create table articles (
article_id integer primary key,
-- who contributed this and when
creation_user not null references users,
creation_date not null date,
-- what language is this in?
-- visit http://www.w3.org/International/O-charset-lang
-- to see the allowable 2-character codes (en is English, ja is Japanese)
language char(2) references language_codes,
-- could be text/html or text/plain or some sort of XML document
mime_type varchar(100) not null,
-- will hold the title in most cases
one_line_summary varchar(200) not null,
-- the entire article; 4 GB limit
body clob
);
create table articles (
article_id integer primary key,
creation_user not null references users,
creation_date not null date,
language char(2) references language_codes,
mime_type varchar(100) not null,
one_line_summary varchar(200) not null,
body clob,
editorial_status varchar(30)
check (editorial_status in ('submitted','rejected','approved','expired'))
);
create table articles_raw (
article_id integer primary key,
...
editorial_status varchar(30)
check (editorial_status in ('submitted','rejected','approved','expired'))
);
create view articles_approved
as
select *
from articles_raw
where editorial_status = 'approved';
select * from articles_approved;
instead of
select * from articles_raw where status='approved';
create table comments_on_articles_raw (
comment_id integer primary key,
-- on what article is this a comment?
refers_to not null references articles,
creation_user not null references users,
creation_date not null date,
language char(2) references language_codes,
mime_type varchar(100) not null,
one_line_summary varchar(200) not null,
body clob,
editorial_status varchar(30)
check (editorial_status in ('submitted','rejected','approved','expired'))
);
create view comments_on_articles_approved
as
select *
from comments_on_articles_raw
where editorial_status = 'approved';
This table differs from the articles table only in a
single column: refers_to. How about combining the two:
create table content_raw (
content_id integer primary key,
-- if not NULL, this row represents a comment
refers_to references content_raw,
-- who contributed this and when
creation_user not null references users,
creation_date not null date,
-- what language is this in?
-- visit http://www.w3.org/International/O-charset-lang
-- to see the allowable 2-character codes (en is English, ja is Japanese)
language char(2) references language_codes,
-- could be text/html or text/plain or some sort of XML document
mime_type varchar(100) not null,
one_line_summary varchar(200) not null,
-- the entire article; 4 GB limit
body clob,
editorial_status varchar(30)
check (editorial_status in ('submitted','rejected','approved','expired'))
);
-- if we want to be able to write some scripts without having to think
-- about the fact that different content types are merged
create view articles_approved
as
select *
from content_raw
where refers_to is null
and editorial_status = 'approved';
create view comments_on_articles_approved
as
select *
from content_raw
where refers_to is not null
and editorial_status = 'approved';
create table content_raw (
content_id integer primary key,
refers_to references content_raw,
creation_user not null references users,
creation_date not null date,
release_time date, -- NULL means "immediate"
expiration_time date, -- NULL means "never expires"
language char(2) references language_codes,
mime_type varchar(100) not null,
one_line_summary varchar(200) not null,
body clob,
editorial_status varchar(30)
check (editorial_status in ('submitted','rejected','approved','expired'))
);
create table content_raw (
content_id integer primary key,
content_type varchar(100) not null,
refers_to references content,
creation_user not null references users,
creation_date not null date,
release_time date,
expiration_time date,
language char(2) references language_codes,
mime_type varchar(100) not null,
one_line_summary varchar(200) not null,
body clob,
editorial_status varchar(30)
check (editorial_status in ('submitted','rejected','approved','expired'))
);
create view news_current_and_approved
as
select *
from content_raw
where content_type = 'news'
and (release_time is null or sysdate >= release_time)
and (expiration_time is null or sysdate <= expiration_time)
and editorial_status = 'approved';
This document was generated using the LaTeX2HTML translator Version 2002 (1.62)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html lecture_5 -split 0 -init_file ./.latex2html-initOne -t 'Content Management '
The translation was initiated by Sean Forman on 2005-09-14
Copyright© 2005, Saint Joseph's University and Sean Forman