Home / Expert Answers / Computer Science / section-1-using-sql-create-tables-according-to-the-given-schema-shown-in-figure-1-the-er-diagram-pa147

(Solved): Section 1 Using SQL, create tables according to the given schema shown in Figure 1. The ER diagram ...



Section 1
Using SQL, create tables according to the given schema shown in Figure 1. The ER
diagram is shown in Figure 3. You fname
name
SSN
Address
CUSTOMER
M
owns
N
ACCOUNT
fee
Iname
phone
N
M
Figure 2 Schema with type
Own_date
balance
aType
BRANCH

Section 1 Using SQL, create tables according to the given schema shown in Figure 1. The ER diagram is shown in Figure 3. You must create your database using exactly the same names (case sensitive) for tables and attributes, using the given type. The type of each attribute is defined in Figure 2. You are required to specify the following constraints: domain constraint, entity integrity constraint, key constraint, and reference key constraint. Branch (name, address) Customer (ssn, fname, Iname, phone, address, fv_branch) foreign key (fv_branch) references Branch (name) Account (acc no, balance, atype,fee) Owns( ssn, acc_no, own_date) foreign key (ssn) references Customer(ssn), foreign key (acc_no) references Account (acc_no) Loan( loan no, amount, ltype, interest_rate) Payment (loan no, payment no, amount, method, status, due_date) foreign key(loan_no) references Loan(loan_no) Borrows(ssn, loan_no) foreign key (ssn) references Customer(ssn), foreign key (loan_no) references Loan (loan_no) Figure 1 Schema Branch (name: VARCHAR(25), address: VARCHAR(50)) Customer (ssn: CHAR(9), fname: VARCHAR(25), Iname: VARCHAR (25), phone CHAR(10), address: VARCHAR (50), fv_branch: VARCHAR(25)) Account (acc no: CHAR(9), balance: DECIMAL (15,2), atype: VARCHAR(10), fee: DECIMAL (7,2)) Owns( ssn: CHAR(9), acc_no: CHAR(9), own_date: DATE) foreign key (ssn) references customer(ssn), foreign key (acc_no) references account (acc_no) Note: DATE is in the format of 'yyyy-mm-dd'. Loan( loan no: CHAR(9), amount: DECIMAL(15,2), ltype: VARCHAR(10), interest rate: DECIMAL (7,4)) Payment (loan_no: CHAR(9), payment_no: CHAR(4), amount: DECIMAL(10,2), method: VARCHAR(10), status: VARCHAR(10), due_date: DATE) foreign key(loan_no) references loan(loan_no) Borrows(ssn: CHAR(9), loan no: CHAR(9)) foreign key (ssn) references customer(ssn), foreign key (loan_no) references loan (loan_no) fname name SSN Address CUSTOMER M owns N ACCOUNT fee Iname phone N M Figure 2 Schema with type Own_date balance aType BRANCH favorite Borrows Acc No. Loan No. Address Name LOAN Payment No Payment Amount Amount LOAN PYMT Method Figure 3 ER Diagram type interest rate Status PAYMENT DueDate Section 2 (1) Populate the database. Insert at least two tuples to the "Payment" table. For each of the other tables, insert at least one tuple. For the payment table, you can populate some payments with the following information, such as: method = 'online', status = 'Late'. (2) Execute one delete statement to the "Payment" table. (3) Execute one update statement to the "Account" table to change the value of "balance". Section 3 Specify the statements to drop all the tables. Pay attention to the order of the drop statements in order to drop everything successfully.


We have an Answer from Expert

View Expert Answer

Expert Answer


SECTION 1:- SQL queries:- drop database if exists 17jan; create database if not exists 17jan; use 17jan; create table Branch(name varchar(25) primary key,address varchar(50)); create table Customer(ssn char(9) primary key,fname varchar(25),lname
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe