Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can you solve this ? I got some error from this query. Advanced SQL ... Continuation 1. SELECT LName, FName, AGE, ACCTNO, CASE CSTATUS WHEN
can you solve this ? I got some error from this query.
Advanced SQL ... Continuation 1. SELECT LName, FName, AGE, ACCTNO, CASE CSTATUS WHEN 'S' THEN 'Single' WHEN 'M' THEN 'Married' END AS STATUS FROM Customer ORDER BY LNAME ASC 2. SELECT A.ACCTNO, LName, FName, CSTATUS, BALANCE, BRANCHNO, ACCT_TYPE, CASE ACCT_TYPE WHEN 'Savings' THEN BALANCE * .025 WHEN 'Checking' THEN BALANCE * .050 WHEN 'Time Deposit' THEN BALANCE * .075 END AS INTEREST FROM ACCOUNT AS A, CUSTOMER AS C WHERE A.ACCTNO = C.ACCTNO Create a SELECT statement that will connect the 3 tables, namely, CUSTOMER, BANK_BRANCH, and LOAN. Display the following columns, Custno, Lname, Fname, BranchNo, Code, LoanNo, LoanType. Also, display the Loan Interest (see below Loan Interest computations). Note: Your LOAN table should have the following attributes: LoanNo, Loan_Type, CustNo, Branch No, Code. Also, Loan_Type are the following, Car Loan, Housing Loan, Personal Loan, Calamity Loan. Loan Interest: 1. 11% for Car Loan 2. 13% for Housing Loan 3. 7% for Personal Loan 4. 5% for Calamity Loan =========== AGGRAGATE FUNCTIONS formed or calculated by the combination of many separate units or items; total. The SQL MIN() and MAX() Functions The MIN() function returns the smallest value of the selected column. The MAX() function returns the largest value of the selected column. INSERT INTO CUSTOMER (CUSTNO, LNAME, FNAME, BRANCHNO, CODE, LOAN_NO, LOAN_TYPE, LOAN INTEREST) VALUES (101, 'ONOYA', 'DENISSE',101,101, '1101','CAR LOAN',0.1l); INSERT INTO CUSTOMER (CUSTNO, LNAME, FNAME, BRANCHNO, CODE, LOAN_NO, LOAN_TYPE, LOAN_INTEREST) VALUES (102, 'KLEIN', 'PAUL',102,102, '1102', 'HOUSING LOAN', 0.13); INSERT INTO CUSTOMER (CUSTNO, LNAME, FNAME, BRANCHNO, CODE, LOAN_NO, LOAN_TYPE, LOAN_INTEREST) VALUES (103, 'SQUAREPANTS', 'SPONGEBOB',103,103,'1103', 'PERSONAL LOAN INSERT INTO CUSTOMER (CUSTNO, LNAME, FNAME, BRANCHNO, CODE, LOAN_NO, LOAN_TYPE, LOAN INTEREST) VALUES (104, 'STAR', 'PATRICK', 104, 104, 'L104', 'CALAMITY LOAN', 0.05); INSERT INTO CUSTOMER (CUSTNO, LNAME, FNAME, BRANCHNO, CODE, LOAN_NO, LOAN_TYPE, LOAN_INTEREST) VALUES (105, 'BAE', 'SUZY', 105, 105, 'L105', 'CAR LOAN', 0.11); SELECT * FROM CUSTOMER; CREATE TABLE LOAN (LOAN_NO VARCHAR (20) PRIMARY KEY NOT NULL, CUSTNO INTEGER, LOAN_TYPE VARCHAR (50), BRANCHNO INTEGER, CODE INTEGER, CONSTRAINT FKCUSTNO FOREIGN KEY INSERT INTO LOAN (LOAN_NO, CUSTNO, LOAN_TYPE, BRANCHNO, CODE) VALUES ('L101',101, 'CAR LOAN',101,101); INSERT INTO LOAN (LOAN_NO, CUSTNO, LOAN_TYPE, BRANCHNO, CODE) VALUES ('L102',102, 'HOUSING LOAN', 102, 102); INSERT INTO LOAN (LOAN_NO, CUSTNO, LOAN_TYPE, BRANCHNO, CODE) VALUES ('L103',103, 'PERSONAL LOAN', 103, 103); INSERT INTO LOAN (LOAN_NO, CUSTNO, LOAN_TYPE, BRANCHNO, CODE) VALUES ('1104', 104, 'CALAMITY LOAN',104,104); INSERT INTO LOAN (LOAN_NO, CUSTNO, LOAN_TYPE, BRANCHNO, CODE) VALUES ('L105, 105, 'CAR LOAN', 105, 105); SELECT * FROM LOAN; CREATE TABLE BANK_BRANCH (LOAN_NO VARCHAR (20), LOAN_TYPE VARCHAR (50), CUSTNO INTEGER PRIMARY KEY NOT NULL, LOAN INTEREST DOUBLE, CUST_NAME VARCHAR (50), CONSTRAINT INSERT INTO BANK_BRANCH (LOAN_NO, LOAN_TYPE, CUSTNO, LOAN_INTEREST, CUST_NAME) VALUES ('1101','CAR LOAN, 101,0.11, 'Denisse Onoya'), ('1102', 'HOUSING LOAN, 102,0.13, 'Paul Klein'), ('1103', 'PERSONAL LOAN', 103,0.07, 'Spongebob Squarepants'), (1104', 'CALAMITY LOAN', 104,0.05, 'Patrick Star'), ('L105', 'CAR LOAN', 105,0.11, 'Suzy Bae')Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started