Write a query to create client table schema in such a way that if we delete row from parent, its corresponding matching row must be deleted in child table. Write sql query to list all clients who have applied for loan. Write sql query to display details of those clients whose loan status is ‘accepted’. Create a view of client to display client name, address, and bank and loan status. Create a view of client to display loan amount of those clients who belong to Karachi. Create a view so that client can see only HBL bank account details. Create a view to display max amount of loan gender wise. Write a query to give SELECT and DELETE rights on column loan status to Tahir.  Write a query to give all rights on column loan status and loan to Tahir and Javeria and take back rights. Write a query to display all the data from both tables.   I Need Queries Output of the following create table Accounts (account_no number primary key, client_name varchar2(200),Gender varchar2(20),address Varchar2(200)); create table loans (branch_id number, bank_name varchar2(200),Loan number, loan_Status varchar2(200),account_no number references Accounts(account_no) ON DELETE CASCADE);   delete from accounts where account_no= 101; select * from accounts  a where exists (select 1 from loans l where l.account_no= a.account_no) select * from accounts a  where exists (select 1 from loans l  where l.account_no= a.account_no and status = 'accepted') 4. create or replace view view1 as select client_name , address,l.bank_name,l.loan_Status from accounts a, loans l where a.account_no = l.account_no   5.create or replace view view2  as  select client_name , address,l.bank_name,l.loan_Status from accounts a, loans l where a.account_no = l.account_no and address = 'Karachi' 6. create or replace view view3 as  select client_name , address,l.bank_name,l.loan_Status from accounts a, loans l where a.account_no = l.account_no and bank_name= 'HBL' 7. select gender,max(Loan) from accounts a, loans l where a.account_no = l.account_no group by gender   8. select a.*, l.* from accounts a, loans l where a.account_no = l.account_no

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Note: Attach query and screenshot of output. 

 

Account_no

Client name

Gender

address

 

101

Tahir

M

Karachi

 

102

Umar

M

Isb

 

103

Javeria

F

karachi

 

104

Asma  

F

lahore

 

105

Sohail

M

multan

 

Branch_ID

Bank_Name

Loan

Loan status

Account_no

201

HBL

80000

open

101

202

UBL

90000

pending

102

203

JS

77000

accepted

103

204

Metro

68000

Accepted 

101

205

Al Habib

75000

close

null

                 

 

 

  1. Write a query to create client table schema in such a way that if we delete row from parent, its corresponding matching row must be deleted in child table.
  2. Write sql query to list all clients who have applied for loan.
  3. Write sql query to display details of those clients whose loan status is ‘accepted’.
  4. Create a view of client to display client name, address, and bank and loan status.
  5. Create a view of client to display loan amount of those clients who belong to Karachi.
  6. Create a view so that client can see only HBL bank account details.
  7. Create a view to display max amount of loan gender wise.
  8. Write a query to give SELECT and DELETE rights on column loan status to Tahir. 
  9. Write a query to give all rights on column loan status and loan to Tahir and Javeria and take back rights.
  10. Write a query to display all the data from both tables.

 

I Need Queries Output of the following

create table Accounts (account_no number primary key, client_name varchar2(200),Gender varchar2(20),address Varchar2(200));

create table loans (branch_id number, bank_name varchar2(200),Loan number, loan_Status varchar2(200),account_no number references Accounts(account_no) ON DELETE CASCADE);

 

  1. delete from accounts where account_no= 101;
  2. select * from accounts  a where exists (select 1 from loans l where l.account_no= a.account_no)
  3. select * from accounts a  where exists (select 1 from loans l  where l.account_no= a.account_no and status = 'accepted')

4.

create or replace view view1 as

select client_name , address,l.bank_name,l.loan_Status

from accounts a, loans l

where a.account_no = l.account_no

 

5.create or replace view view2 

as 

select client_name , address,l.bank_name,l.loan_Status

from accounts a, loans l

where a.account_no = l.account_no

and address = 'Karachi'

6.

create or replace view view3

as 

select client_name , address,l.bank_name,l.loan_Status

from accounts a, loans l

where a.account_no = l.account_no

and bank_name= 'HBL'

7.

select gender,max(Loan)

from accounts a, loans l

where a.account_no = l.account_no

group by gender

 

8.

select a.*, l.*

from accounts a, loans l

where a.account_no = l.account_no

 

Expert Solution
steps

Step by step

Solved in 4 steps with 7 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY