CPSC 3375 - Final Project ER Diagram
CPSC 3375 - Final Project ER Diagram
CPSC 3375 - Final Project ER Diagram
Phone
(1,1) (0,M)
PortfolioID Portfolios Maintain Customers Address
(0,M)
Maintained by
Name
CustomerID
QuantityTraded CostPerShare
Are Contained
In
PurchaseDate TransactionID
Location
(0,M)
OpenTime
(1,1) (1,M)
Stocks Trade Markets
MarketName
Review
(1,M)
Name
Analysts
Phone
AnalystID
CPSC 3375 – Final Project ER Diagram
November 9, 2005 Benjamin A. Balogh
Table Design:
Functional Dependencies:
CONTENTS of load.sql
------------------------------------------------------------------
set echo on
spool /home/cpsc337505/Project/log/load.log
------------------------------------------------------------------
-- Benjamin A. Balogh
-- Final Project
-- November 28, 2005
-- CPSC3375 - Database Concepts I
-- Sean J. Geoghegan, Ph.D.
-- Setup Online Stock Management System Tables
------------------------------------------------------------------
-- Drop All Tables
drop table PORTFOLIO_CONTENTS;
drop table STOCKHISTORY;
drop table ANALYSIS;
drop table PORTFOLIO;
drop table STOCKS;
drop table MARKETS;
drop table ANALYST;
drop table CUSTOMERS;
------------------------------------------------------------------
-- Create MARKETS Table
create table MARKETS
(
Market_Name varchar2(10) not null,
Street varchar2(50) not null,
City varchar2(30) not null,
State char(2) not null,
Zip_Code char(5) not null,
CPSC 3375 – Final Project ER Diagram
November 9, 2005 Benjamin A. Balogh
------------------------------------------------------------------
-- Create PORTFOLIO_CONTENTS Table
create table PORTFOLIO_CONTENTS
(
PortfolioID integer
not null
references PORTFOLIO(PortfolioID)
ON DELETE CASCADE,
TransactionID integer
not null
references STOCKHISTORY(TransactionID)
ON DELETE CASCADE,
primary key(TransactionID)
);
------------------------------------------------------------------
-- Create ANALYST Table
create table ANALYST
(
AnalystID integer not null,
Analyst_Name varchar2(30) not null,
Phone char(12) not null,
primary key(AnalystID)
);
------------------------------------------------------------------
-- Create ANALYSIS Table
create table ANALYSIS
(
AnalystID integer
not null
references ANALYST(AnalystID)
ON DELETE CASCADE,
Symbol varchar2(5)
not null
references STOCKS(Symbol)
ON DELETE CASCADE,
Quarter char(6) not null,
Earnings float default 0.0,
Revenue float default 0.0,
primary key(AnalystID, Symbol, Quarter)
);
------------------------------------------------------------------
spool off
set echo off
------------------------------------------------------------------