Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Cant get SQL script to run, please help. Im having trouble getting this SQL script to run and I need all of this info to

Cant get SQL script to run, please help.

Im having trouble getting this SQL script to run and I need all of this info to be included ... please help

create table member (member_id Integer NOT NULL , First_Name Varchar(100) , Last_Name Varchar(100) , SSN Char(9) , Address Varchar(100) , City Varchar(100) , State Varchar(100) , Zip_Code Varchar(100) , Phone_No Char(10) , Email_Address Varchar(100) , PRIMARY KEY (member_id));

create table messages (member_id Integer NOT NULL , message_id Integer NOT NULL , message Varchar (100) , PRIMARY KEY ( message_id, member_id ));

create table member_messages (message_id Integer NOT NULL , member_id Integer NOT NULL , PRIMARY KEY ( message_id ,member_id ) , FOREIGN KEY (message_id ) REFERENCES messages (message_id ) , FOREIGN KEY (member_id ) REFERENCES member(member_id ));

create table rate ( rate_id Integer NOT NULL , current_interest_rate Decimal (3,2) , account_type Char (50) , CONSTRAINT rate_pk PRIMARY KEY ( rate_id ) );

CREATE TABLE accounts (account_no Integer NOT NULL, member_id Integer, primary_owner_first VARCHAR(100), primary_owner_last VARCHAR(100), joint_owner_first VARCHAR(100), joint_owner_last VARCHAR(100), rate_id Integer, current_balance integer, PRIMARY KEY(member_id, account_no), FOREIGN KEY(rate_id) REFERENCES rate (rate_id));

create table transactions ( transaction_id Integer NOT NULL , account_no Integer , initiator Char (50) , amount integer , date_time timestamp , transaction_type Char(50), PRIMARY KEY (transaction_id, account_no),

create table member (member_id Integer NOT NULL , First_Name Varchar(100) , Last_Name Varchar(100) , SSN Char(9) , Address Varchar(100) , City Varchar(100) , State Varchar(100) , Zip_Code Varchar(100) , Phone_No Char(10) , Email_Address Varchar(100) , PRIMARY KEY (member_id));

create table messages (member_id Integer NOT NULL , message_id Integer NOT NULL , message Varchar (100) , PRIMARY KEY ( message_id, member_id ));

create table member_messages (message_id Integer NOT NULL , member_id Integer NOT NULL , PRIMARY KEY ( message_id ,member_id ) , FOREIGN KEY (message_id ) REFERENCES messages (message_id ) , FOREIGN KEY (member_id ) REFERENCES member(member_id ));

create table rate ( rate_id Integer NOT NULL , current_interest_rate Decimal (3,2) , account_type Char (50) , CONSTRAINT rate_pk PRIMARY KEY ( rate_id ) );

CREATE TABLE accounts (account_no Integer NOT NULL, member_id Integer, primary_owner_first VARCHAR(100), primary_owner_last VARCHAR(100), joint_owner_first VARCHAR(100), joint_owner_last VARCHAR(100), rate_id Integer, current_balance integer, PRIMARY KEY(member_id, account_no), FOREIGN KEY(rate_id) REFERENCES rate (rate_id));

create table transactions ( transaction_id Integer NOT NULL , account_no Integer , initiator Char (50) , amount integer , date_time timestamp , transaction_type Char(50), PRIMARY KEY (transaction_id, account_no) );

Create table daily_balance (account_no INTEGER NOT NULL, End_of_Day_Balance INTEGER NOT NULL, date_time Timestamp, Constraint daily_bal_PK PRIMARY KEY (account_no, End_of_Day_Balance) );

create table cd ( account_no Integer NOT NULL , interest_rate Decimal (3,2) , last_interest_date date , terms Char (20) , CONSTRAINT cd_PK PRIMARY KEY ( account_no), FOREIGN KEY (account_no) REFERENCES accounts (account_no), );

create table loan ( account_no Integer NOT NULL , interest_rate decimal (3,2) , loan_type Varchar (50) , principal integer , unpaid_interest Char (100) , annual_rate Decimal (3,2), monthly_payment integer , termination_date date , next_payment_due_date date , next_payment_due_amt Integer , fixed_rate Decimal (3,2), fixed_monthly_pmt integer , account_status Char (5) , CONSTRAINT loan_PK PRIMARY KEY ( account_no ), FOREIGN KEY (account_no) REFERENCES accounts (account_no), ); create table checking ( account_no Integer NOT NULL , Balance integer, min_bal_req Char (100) , interest_rate Decimal (3,2), last_interest_date date , End_of_Day_Balance Integer, CONSTRAINT checking_PK PRIMARY KEY ( account_no), FOREIGN KEY (account_no) REFERENCES accounts (account_no), FOREIGN KEY (End_of_Day_Balance) REFERENCES daily_balance(End_of_Day_Balance) );

create table savings ( account_no Integer NOT NULL , Balance Integer , min_bal_req Integer , interest_rate Decimal(3,2) , last_interest_date date , CONSTRAINT savings_PK PRIMARY KEY ( account_no), FOREIGN KEY (account_no) REFERENCES accounts(account_no), FOREIGN KEY (End_of_Day_Balance) REFERENCES daily_balance(End_of_Day_Balance) );

Create table member_accounts (member_id Integer NOT NULL, account_no Integer NOT NULL, PRIMARY KEY (member_id, account_no), FOREIGN KEY (member_id) REFERENCES member(member_id), FOREIGN KEY (account_no) REFERENCES accounts(account_no) );

Create table transfer (transaction_id Integer NOT NULL , account_no Integer NOT NULL, account_no_2 Integer, amount Integer, PRIMARY KEY (transaction_id, account_no), FOREIGN KEY (transaction_id) REFERENCES transactions(transaction_id), FOREIGN KEY (account_no) REFERENCES transactions(account_no) );

);

Create table daily_balance (account_no INTEGER NOT NULL, End_of_Day_Balance INTEGER NOT NULL, date_time Timestamp, Constraint daily_bal_PK PRIMARY KEY (account_no, End_of_Day_Balance) );

create table cd ( account_no Integer NOT NULL , interest_rate Decimal (3,2) , last_interest_date date , terms Char (20) , CONSTRAINT cd_PK PRIMARY KEY ( account_no), FOREIGN KEY (account_no) REFERENCES accounts (account_no), );

create table loan ( account_no Integer NOT NULL , interest_rate decimal (3,2) , loan_type Varchar (50) , principal integer , unpaid_interest Char (100) , annual_rate Decimal (3,2), monthly_payment integer , termination_date date , next_payment_due_date date , next_payment_due_amt Integer , fixed_rate Decimal (3,2), fixed_monthly_pmt integer , account_status Char (5) , CONSTRAINT loan_PK PRIMARY KEY ( account_no ), FOREIGN KEY (account_no) REFERENCES accounts (account_no), ); create table checking ( account_no Integer NOT NULL , Balance integer, min_bal_req Char (100) , interest_rate Decimal (3,2), last_interest_date date , End_of_Day_Balance Integer, CONSTRAINT checking_PK PRIMARY KEY ( account_no), FOREIGN KEY (account_no) REFERENCES accounts (account_no), FOREIGN KEY (End_of_Day_Balance) REFERENCES daily_balance(End_of_Day_Balance) );

create table savings ( account_no Integer NOT NULL , Balance Integer , min_bal_req Integer , interest_rate Decimal(3,2) , last_interest_date date , CONSTRAINT savings_PK PRIMARY KEY ( account_no), FOREIGN KEY (account_no) REFERENCES accounts(account_no), FOREIGN KEY (End_of_Day_Balance) REFERENCES daily_balance(End_of_Day_Balance) );

Create table member_accounts (member_id Integer NOT NULL, account_no Integer NOT NULL, PRIMARY KEY (member_id, account_no), FOREIGN KEY (member_id) REFERENCES member(member_id), FOREIGN KEY (account_no) REFERENCES accounts(account_no) );

Create table transfer (transaction_id Integer NOT NULL , account_no Integer NOT NULL, account_no_2 Integer, amount Integer, PRIMARY KEY (transaction_id, account_no), FOREIGN KEY (transaction_id) REFERENCES transactions(transaction_id), FOREIGN KEY (account_no) REFERENCES transactions(account_no) )

thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions