0% found this document useful (0 votes)
2 views8 pages

SQL Commands

The document outlines a series of SQL commands for managing a database named 'loans'. It includes instructions for creating tables, inserting data, displaying loan details based on various conditions, updating interest rates, and performing data manipulations. Additionally, it provides commands for selecting and formatting data from the loan_accounts table.

Uploaded by

mridulsardanag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

SQL Commands

The document outlines a series of SQL commands for managing a database named 'loans'. It includes instructions for creating tables, inserting data, displaying loan details based on various conditions, updating interest rates, and performing data manipulations. Additionally, it provides commands for selecting and formatting data from the loan_accounts table.

Uploaded by

mridulsardanag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1. Create the database loans.

2. Use database loans.

1. Create table loan_accounts and insert tuples in it.


Display details of all the loans.

Display the accno, cust_name and loan_amount of all the loans.


Display details of all the loans with less than 40 installments

Display the accno and loan_amount of all the loans started before 01-04-2009.

Display the int_rate of all the loans started after 01-04-2009.

Display the details of all the loans whose rate of interest is null.
Display the amount of various loans from the table loan_accounts. A loan amount should
appear only once.

Display the cust_name and loan_amount for all the loans which do not have number of
installments 36.

Display the cust_name and loan_amount for all the loans for which the loan amount is less than
500000 or int_rate is more than 12.

Display the details of all the loans whose rate of interest is in the range 11% to 12%.
Display the cust_name and loan_amount for all the loans for which the number of installments
are 24, 36, or 48.

Display the details of all the loans whose loan_amount is in the range 400000 to 500000.

Display the accno, cust_name, loan_amount for all the loans for which the cust_name ends with
“khuntia”.

Display the accno, cust_name, and loan_amount for all the loans for which the cust_name contains ‘i’
as the second last character.
Display the details of all the loans in the ascending order of their loan_amount.

Display the details of all the loans in the descending order of their start_date.

Put the interest rate 11.50% for all the loans for which interest rate is null.

For each loan replace interest with (loan_amount * int_rate*installments)/12*100.


Delete the records of all the loans of “j.khuntia”.

Add another category of type char(1) in the loan_accounts table.

Select cust_name , length(cust_name), lcase(cust_name),

Ucase(cust_name) from loan_accounts where int_rate <11.00;

Select dayname(start_date) from loan_accounts;

Select round(int_rate*110/100,2) from loan_accounts where int_rate >10;

Select pow(4,3), pow(3,4);


Select round(543.5694,2) , round(543.5694), round(543.5634,-1);

Select truncate(543.5694,2), truncate(543.5694,-1);

Select concat(“jyoti”, “ prakash”) “full name”;

Select year(curdate()), month(curdate()), day(curdate());

Select mid(“information”,3,4),substr(“technology”,3);

You might also like