0% found this document useful (0 votes)
203 views2 pages

Lab 9 DML

The document outlines 28 SQL queries to manipulate data in a banking database, including finding loan details by branch, customer names and loans, updating account balances, and modifying database tables. It also provides a list of common date/time functions that can be used in the queries such as YEAR, DAYNAME, MONTHNAME, and DATEDIFF.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
203 views2 pages

Lab 9 DML

The document outlines 28 SQL queries to manipulate data in a banking database, including finding loan details by branch, customer names and loans, updating account balances, and modifying database tables. It also provides a list of common date/time functions that can be used in the queries such as YEAR, DAYNAME, MONTHNAME, and DATEDIFF.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

Lab 9: Data Manipulation with SQL (October 10, 2017)

1) List the branch names of all branches that gave loan.

2) List the names of all branches in the loan without repetition.

3) List all details of loan by increasing the amount multiplied by 500 of each loan.

4) Find all loan number for loans made at the S street branch with loan amounts greater
than Rs. 1,200.

5) Find the loan number of those loans with loan amounts between Rs. 900 and Rs. 1600.

6) Find the name, loan number and loan amount of all customers having a loan at the
S street branch.

7) Find the Cartesian product of borrower and loan.

8) Find the name, loan number and loan amount of all customers having a loan at the S
street branch.

9) Find the name, loan number and loan amount of all customers (rename the column name
loan_number as loan_id). Order by name.

10) Find the customer names and their loan numbers for all customers having a loan at some
branch.

11) Find the names of all branches that have greater assets than some branch located in
Hyderabad.

12) Find the names of all customers whose street includes the substring Street.

13) List in alphabetic order the names of all customers having a loan in S Street branch.
Arrange in the order of descending loan amount within customer names.

14) Find bank accounts with a balance under Rs. 700 order by increasing bank balance.

15) Get the accounts with their balance updated in the year 2012. Display them by decreasing
order of balance.

16) Retrieve a list of all bank branch details, ordered by branch city, with each citys
branches listed in reverse order of holdings.

17) Find all customers who have a loan, an account, or both.

18) Find all customers who have both a loan and an account.

19) Find the average account balance at the S Street branch.


20) Find the number of depositors for each branch.

21) Find the name of customers from Patna city with balance along with the name of day and
month on which the account is updated.

22) Find the names of all branches where the average account balance is more than Rs. 600.

23) Find all customers whose address is unknown.

24) Find all branches that have greater assets than some branch located in Delhi.

25) Increase all accounts with balances over Rs. 500 by 10%, all other accounts receive 5%.
(execute two update statements)

26) Add a new attribute country to table branch.

27) Change the domain of the branch_city attribute of the branch table to varchar (30).

28) Make the branch_city of the branch table has a default value of Mumbai.

Remember:

Function Name Action

YEAR Fetches the numeric value of year from date.

DAYNAME Determines day of a date.

MONTHNAME Determines month of a date.

DAYOFYEAR Calculates what day of the year it is.

DATEDIFF Calculates difference in days between two dates or timestamps.

You might also like