Ch 1 Querying and SQL Functions 2024-25
Ch 1 Querying and SQL Functions 2024-25
Syllabus 2024-25 :
Revision of database concepts and SQL commands covered in class XI
Math functions: POWER (), ROUND (), MOD ().
Text functions: UCASE ()/ UPPER (), LCASE ()/ LOWER (), MID ()/
SUBSTRING () /SUBSTR (), LENGTH (), LEFT (), RIGHT (), INSTR (), LTRIM
(), RTRIM (), TRIM ().
Date Functions: NOW (), DATE (), MONTH (), MONTHNAME (), YEAR (), DAY
(), DAYNAME ().
Aggregate Functions: MAX (), MIN (), AVG (), SUM (), COUNT (); using
COUNT (*).
Querying and manipulating data using Group by, Having, Order by.
Working with two tables using equi-join
b) Write the differences between Single row and Multiple row Functions
SELECT POW(2,4);
Result: 16
SELECT POW(2,-2);
Result: 0.25
SELECT POW(-2,3);
Result:-8
SELECT SQRT(26);
Result: 5.09901951
SELECT SQRT(25);
Result: 5
iii) MOD(m,n) – Returns modulus (i.e. remainder) of the given two number.
SELECT MOD(11,4);
Result: 3
SELECT MOD(25,5);
Result: 0
iv) SIGN(n) –Returns sign of the given number. If n<0, returns -1; If n=0,
returns 0; If n>0, returns 1
SELECT SIGN(-11);
Result: -1
SELECT SIGN(25);
Result: 1
SELECT ROUND(6.298,1);
Result: 6.3
SELECT ROUND(-1.58);
Result: -2
SELECT ROUND(-1.23);
Result: -1
SELECT ROUND(-1.58);
Result: -2
SELECT ROUND(1.43);
Result: 1
c) If negative value is specified for precision, it counts off that value left from
the decimal point to nearest ten‟s/hundred‟s etc.
SELECT ROUND(56.235,-1);
Result: 60
SELECT ROUND(55.235,-1);
Result: 60
SELECT ROUND(54.235,-1);
Result: 50
Chapter 1:Quering and SQL Functions 3|P a g e
Pr ep ar ed b y : T ap o sh Kar mak ar AIR F OR CE S CH OO L J O RHA T | Mob il e : 70 0 20 70 31 3
Lat e st Up d a te on : 1 6 Ju l y 20 2 4
Class Notes :2024-25
SELECT ROUND(54.235,-2);
Result: 100
SELECT ROUND(500.35,-3);
Result: 1000
SELECT TRUNCATE(7.543,1);
Result: 7.5
SELECT TRUNCATE(4.567,0);
Result: 4
i) ASCII() – Returns the ASCII value of the leftmost character of the string
str. Returns 0 if str is an empty string. Returns NULL if str is NULL.
SELECT ASCII(„2‟);
Result: 50
SELECT ASCII('dx');
Result: 100
SELECT ASCII('A');
Result: 65
SELECT ASCII('');
Result: 0
ii) CHAR() – This function returns the character for each integer passed.
SELECT CHAR(70,65,67,69);
Result :
+--------------------+
| char(70,65,67,69) |
+--------------------+
| FACE |
+--------------------+
SELECT CONCAT('Class„,NULL,'XI');
Result: NULL
SELECT LOWER('INFORMATICS');
Result: 'informatics'
SELECT UPPER('informatics');
Result: 'INFORMATICS'
SELECT SUBSTRING('Informatics',-3);
Result: ‘ics'
SELECT SUBSTRING('Informatics',3,4);
Result: 'form'
SELECT MID('Informatics„,3,4);
Result: 'form'
vii) LEFT(str,len) – Returns the specified number of characters (len) from the
left side of string str.
Result: 'Inf'
viii) RIGHT(str,len) – Returns the specified number of characters (len) from the
right side of string str.
x) INSTR(str1,str2) – This function searches for given second string into the
given first string and returns the position number of the first occurrence of
substring str2 in string str1.
Result: 3
xi) LTRIM(str) – Removes leading spaces i.e. removes spaces from the left side
of the string str.
xii) RTRIM(str) – Removes trailing spaces i.e. removes spaces from the right
side of the string str.
xiii) TRIM(str) – Removes both leading and trailing spaces from the string str.
SELECT CURDATE();
Result: '2013-11-24'
ii) NOW() - Returns the current date and time in 'YYYY-MM-DD HH:MM:SS'
or YYYYMMDDHHM MSS.uuuuuu format, depending on whether the
function is used in a string or numeric context.
SELECT NOW();
Result: 2013-11-24 20:53:54
SELECT SYSDATE();
Result: 2013-11-24 20:53:54
v) MONTH(date) - Returns the numeric month from the date passed, in the
range 0 to 12. It returns 0 for dates such as '0000-00-00' or '2010-00-00‘
that have a zero month part.
SELECT MONTH('2010-02-26');
Result: 2
vi) YEAR(date) - Returns the year for date passed in the range 0 to 9999.
Returns values like 1998, 2010,1996 and so on.
SELECT YEAR('2013-11-24');
Result: 2013
vii) DAYNAME(date) - returns the name of the weekday for the date passed
SELECT DAYNAME('2009-07-21');
Result:'Tuesday'
viii) DAYOFMONTH(date) - Returns the day of the month in the range 0 to31.
SELECT DAYOFMONTH('2010-02-26');
Result: 26
SELECT DAYOFWEEK('2013-11-24');
Result: 1
x) DAYOFYEAR(date) - Return the day of the year for the given date in
numeric format in the range 1 to 366.
Chapter 1:Quering and SQL Functions 10 | P a g e
Pr ep ar ed b y : T ap o sh Kar mak ar AIR F OR CE S CH OO L J O RHA T | Mob il e : 70 0 20 70 31 3
Lat e st Up d a te on : 1 6 Ju l y 20 2 4
Class Notes :2024-25
SELECT DAYOFYEAR('2013-11-24');
Result: 328
xi) MONTHNAME(date) - It returns the month name from the specified date.
SELECT MONTHNAME(„2003-11-28‟);
Result: November
# MAX() – MAX() function is used to find the Highest Value of any column or any
expression based on a column. MAX() takes one argument which can be any
column name or a valid expression involving a column name.
Q. To find the highest cost of any type of shoe in the factory.
SELECT MAX(cost)FROM shoes;
# MIN() – MIN() function is used to find the Lowest Value of any column or an
expression based on a column. MIN() takes one argument which can be any
column name or a valid expression involving a column name.
# AVG() – AVG() function is used to find the average value of any column or an
expression based on a column. AVG() takes one argument which can be any
column name or a valid expression involving a column name.
Limitation:The argument of AVG() function can be of numeric (int /
decimal) type only.Averages of String and Date type data are not defined.
Q. To find the average margin from shoes table.
SELECT AVG(margin)FROM shoes;
Q. To find the average quantity in stock for the shoes of type Sports.
SELECT AVG(qty)FROM shoes WHERE type=„sports‟;
Q. To find the average quantity in stock for the shoes of type Sports.
SELECT AVG(qty) FROM shoes WHERE type = 'Sports';
# SUM() – SUM() function is used to find the Total Value of any column or an
expression based on a column. SUM() also takes one argument which can be any
column name or a valid expression involving a column name.
Like AVG(), the argument of SUM() function can be of numeric (int/decimal)
type only. Sums of String and Date type data are not defined.
Q. To find the total value (Quantity X Cost) of Shoes of type 'Office' present in the
inventory.
SELECT SUM(cost*qty)FROM shoes WHERE type = 'Office';
10. How are NULL values treated by aggregate functions? Give example.
Ans. None of the aggregate functions takes NULL into consideration. NULL is simply
ignored by all the aggregate functions.
Example 1 :
The average margin has been calculated by adding all the 10 non NULL values
from the margin column and dividing the sum by 10 and not by 13.
11. What is the purpose of using GROUP BY clause in SQL?
Ans. GROUP BY clause is used to group the rows together that contain similar values
in a specified column. Some of the group functions are COUNT(), MAX(), MIN(),
AVG() and SUM().
The GROUP BY clause combines all those records that have identical values in a
particular field or a group of fields. This grouping results into one summary
record per group if group functions are used with it.
GROUP BY clause is used in a SELECT statement in conjunction with aggregate
Chapter 1:Quering and SQL Functions 15 | P a g e
Pr ep ar ed b y : T ap o sh Kar mak ar AIR F OR CE S CH OO L J O RHA T | Mob il e : 70 0 20 70 31 3
Lat e st Up d a te on : 1 6 Ju l y 20 2 4
Class Notes :2024-25
Q. The management of the shoe factory may want to know what is the total quantity
of shoes of various types. i.e., what is the total quantity of shoes of type School,
Office, and Sports each.
SELECT type, SUM(qty) FROM shoes GROUP BY type;
Q. The management may also want to know what is the maximum, minimum, and
average margin of each type of shoes.
SELECT type, MIN(margin), MAX(margin), AVG(margin)
FROM shoes GROUP BY type;
12. What is the purpose of HAVING clause used in conjunction with GROUP BY
clause?
Ans. HAVING clause is used in conjunction with GROUP BY clause in a
SELECTstatement to put condition on groups.It means we want to put some
condition on individual groups (and not on individualrecords).
A condition on groups is applied by HAVING clause.
Q. The management of the shoe factory may want to know which shoes total
quantityis more than 1500.
SELECT type, SUM(qty) FROM shoes
GROUP BY type HAVING SUM(qty) > 1500;
Note :In these statements if we try to put the condition using WHERE instead of
HAVING, we shall get an error.
13. Write the difference between WHERE clause and HAVING clause.
Ans. The WHERE clause is used to restrict records in a query i.e. WHERE condition is
applied on individual row before grouping
Whereas, HAVING clause restricts the records after they have been grouped i.e.
HAVING condition is applied on groups.
14. Can we use both WHERE clause and HAVING in a SELECT statement? Give
reason.
Ans. Yes, we can use both WHERE clause for individual record and HAVING clause
for groups in a SELECT statement.
Example-
Q. The management of the shoe factory may want to know what is the totalquantity of
shoes, of sizes other than 6, of various types. i.e., what is the totalquantity of shoes
(of sizes other than 6) of type School, Office, and Sports each. Moreover, the report
is required only for those groups for which the totalquantity is more than 1500.
SELECT type, SUM(qty) FROM shoes
WHERE size <>6 ->Checks individual row
GROUP BY type HAVING sum (qty) > 1500; ->Checks individual group
Q. The management may also want to know what is the maximum, minimum,
andaverage margin of each type of shoes. But in this reports shoes of sizes 6 and
7only should be included. Report is required only for those groups for which
theminimum margin is more than 2.
SELECT type, MIN(margin), MAX(margin), AVG(margin) FROM shoes
WHERE size in (6,7)
GROUP BY type having MIN(margin) > 2;
Ans. Three different ways to apply Join operation in query statements are –
i) Using condition in WHERE clause – This join repeat the attributes in
its output.
Eg.-
SELECT * FROM UNIFORM U, COST C
WHERE U.UCode = C.UCode;
ii) Explicit use of JOIN clause – JOIN clause explicitly use along with
condition in FROM clause. Hence, no condition needs to be given in
WHERE clause. This join also repeat attributes in the output.
Eg.-
SELECT * FROM UNIFORM U JOIN COST C
ONU.Ucode=C.Ucode;
iii) Explicit use of NATURAL JOIN clause – This join removes the
redundant attributes in its output.
Eg.-
SELECT * FROM UNIFORM NATURAL JOIN COST;
18. Write some of the points to be consideredwhile applying JOIN operations on two
or more relations.
Ans. Following are some of the points to be considered while applying JOIN operations
on two or more relations:
• If two tables are to be joined on equality condition on the common attribute,
then one may use JOIN with ON clause or NATURAL JOIN in FROM clause.
If three tables are to be joined on equality condition, then two JOIN or
NATURAL JOIN are required.
• In general, N-1 joins are needed to combine N tables on equality condition.
• With JOIN clause, we may use any relationaloperators to combine tuples of
two tables.
19. What do you understand by Cartesian Product?
Or,
Explain and Illustrate Cartesian product or Cross Join.
Ans. Cartesian product operation combines tuples from two relations.The
degree of the resulting relation is calculated as the sum of the degrees of both
the relations under consideration. The cardinality of the resulting relation is
calculated as the product of the cardinality of relations on which cartesian
product is applied.
Cartesian product (also called Cross Join) of two tables is a table obtained by
pairing up each row of one table with each row of the other table. This way if two
tables contain 3 rows and 2 rows respectively, then their Cartesian product will
contain 6 (=3x2) rows. This can be illustrated as follows:
In SQL, Cartesian product of two rows is obtained by giving the names ofboth
tables in FROM clause.
Example-
Output-
Q. The management of the shoe factory wants a report of orders which lists three
columns: Order_No, corresponding customer name, and phone number
SELECT order_no , name, phone
FROM orders, customers
WHERE orders.cust_code = customers.cust_code;
Or,
SELECT order_no , name, phone
FROM orders X, customers Y
WHERE X.cust_code = Y.cust_code;
Output :
Q. The management wants the names of customers who have placed any order of
quantity more than 300.
SELECT name, address FROM orders, customers
WHERE orders.cust_code = customers.cust_code
and order_qty> 300;
Output :
Q. The management wants a report in which with each Order_No management needs
name of the corresponding customer and also the total cost (Order quantity X Cost
of the shoe) of the order are shown.
SELECT order_no, Order_Qty, customers.name,
cost*order_qty AS 'Order Cost'
FROM orders, shoes, Customers
WHERE Shoe_Code = code
AND Orders.Cust_Code = Customers.Cust_Code ORDER BY order_no;
Or,
SELECT X.order_no, X.Order_Qty, Z.name,
Y.cost * X.order_qty AS 'Order Cost'
FROM orders X, shoes Y, Customers Z
WHERE X.Shoe_Code = Y.code
AND X.Cust_Code = Y.Cust_Code ORDER BY X.order_no;
Output :
Table : Dance
+--------+--------+-------+
Chapter 1:Quering and SQL Functions 22 | P a g e
Pr ep ar ed b y : T ap o sh Kar mak ar AIR F OR CE S CH OO L J O RHA T | Mob il e : 70 0 20 70 31 3
Lat e st Up d a te on : 1 6 Ju l y 20 2 4
Class Notes :2024-25
| 1 | Mehak | 8A |
| 3 | Lavanya | 7A |
| 5 | Abhay | 8A |
+--------+---------+-------+
b) Write the output(s) produced by executing the following queries on the basis of
the information given above in the table Product:
i) SELECT PName, Avg(UPrice) FROM Product GROUP BY Pname;
ii) SELECT DISTINCT Manufacturer FROM Product;
iii) SELECT COUNT(DISTINCT PName) FROM Product;
iv) SELECT PName, MAX(UPrice), MIN(UPrice) FROM Product GROUP BY
PName;
Ans. i) SELECT PName, Avg(UPrice) FROM Product GROUP BY Pname
+----------------+-------------+
| PName | Avg(UPrice) |
+----------------+-------------+
| Shampoo | 274.0000 |
| Soap | 34.0000 |
| Tooth Paste | 59.5000 |
| Washing Powder | 120.0000 |
+----------------+-------------+
ii) SELECT DISTINCT Manufacturer FROM Product;
+--------------+
| Manufacturer |
+--------------+
| Surf |
| Colgate |
| Lux |
| Pepsodant |
| Dove |
+--------------+
iii) SELECT COUNT(DISTINCT PName) FROM Product;
+-----------------------+
| COUNT(DISTINCT PName) |
+-----------------------+
| 4 |
+-----------------------+
iv) SELECT PName, MAX(UPrice), MIN(UPrice) FROM Product GROUP
BY PName;
+----------------+-------------+-------------+
| PName | MAX(UPrice) | MIN(UPrice) |
+----------------+-------------+-------------+
| Shampoo | 274 | 274 |
| Soap | 43 | 25 |
| Tooth Paste | 65 | 54 |
| Washing Powder | 120 | 120 |
+----------------+-------------+-------------+
5. Consider the following tables Student and Stream in the Streams_of_Students
database. The primary key of the Stream table is StCode (stream code) which is the
foreign key in the Student table. The primary key of the Student table is AdmNo
(admission number).
Table : Student
AdmNo Name StCode
211 Jay NULL
241 Aditya S03
290 Diksha S01
333 Jasqueen S02
356 Vedika S01
380 Ashpreet S03
Table : Stream
StCode Stream
S01 Science
S02 Commerce
S03 Humanities
);
Create Table Student
(
AdmNo int Primary Key,
Name varchar(30),
StCode char(4),
FOREIGN KEY (StCode) REFERENCES Stream(StCode)
);
c) StCode and AdmNois Primary Key in Stream and Student Table
respectively.StCodeis Foreign Key in Student Table.
d) UPDATE STUDENT SET StCode=(SELECT StCode From Stream where
Stream ='Humanities') Where Name='Jay';
e) SELECT Name FROM Student WHERE name LIKE '%a' ORDER BY
name;
+--------+
| Name |
+--------+
| Aditya |
| Diksha |
| Vedika |
+--------+
f) SELECT x.admno, name, y.stream FROM student x, stream y
WHERE x.stcode=y.stcode AND y.stream IN ('Humanities',
'Science') ORDER BY x.name, x.admno;
g) SELECT x.admno, name, y.stream, count(x.stcode) as 'No. of
Students' FROM student x, stream y WHERE x.stcode=y.stcode
GROUP BY x.stcode HAVING count(x.stcode)>1;
h) SELECT x.admno, name, y.stream FROM student x, stream y
WHERE x.stcode=y.stcode ORDER BY admno desc;
i) +-------+----------+--------+--------+------------+
| AdmNo | Name | StCode | StCode | Stream |
+-------+----------+--------+--------+------------+
| 211 | Jay | S03 | S01 | Science |
| 211 | Jay | S03 | S02 | Commerce |
| 211 | Jay | S03 | S03 | Humanities |
| 241 | Aditya | S03 | S01 | Science |
| 241 | Aditya | S03 | S02 | Commerce |
| 241 | Aditya | S03 | S03 | Humanities |
| 290 | Diksha | S01 | S01 | Science |
| 290 | Diksha | S01 | S02 | Commerce |
| 290 | Diksha | S01 | S03 | Humanities |
| 333 | Jasqueen | S02 | S01 | Science |
| 333 | Jasqueen | S02 | S02 | Commerce |
| 333 | Jasqueen | S02 | S03 | Humanities |
| 356 | Vedika | S01 | S01 | Science |
| 356 | Vedika | S01 | S02 | Commerce |
| 356 | Vedika | S01 | S03 | Humanities |
| 380 | Ashpreet | S03 | S01 | Science |
| 380 | Ashpreet | S03 | S02 | Commerce |
| 380 | Ashpreet | S03 | S03 | Humanities |
+-------+----------+--------+--------+------------+
Degree : 5, Cardinality : 18
Chapter 1:Quering and SQL Functions 30 | P a g e
Pr ep ar ed b y : T ap o sh Kar mak ar AIR F OR CE S CH OO L J O RHA T | Mob il e : 70 0 20 70 31 3
Lat e st Up d a te on : 1 6 Ju l y 20 2 4
Class Notes :2024-25
1. Define a Function.
Ans. A Function in MySQL is a special type of pre-defined command set that
performs some operation and returns a single value.
2. List 3 categories of single row functions. Give two examples in each category.
Ans. Single row functions operate on a single value to return a single value.
The three categories of Single Row function are –
i) Numeric functions – Eg. pow(), sqrt(), mod(), round(), truncate()
ii) String functions – Eg.ASCII(), CHAR(), Substring(), INSTR() etc
iii) Date and Time functions – Eg.CURDATE(), NOW(), SYSDATE(), DATE()
Output:
10
v) Display the name of current month.
Ans. SELECT MONTH(CURDATE());
vi) Display the date 10 years from now. Label the column "Future."
Ans. SELECT YEAR(CURDATE())+10 AS „FUTURE‟;
vii) Display the day of week on which your birthday will fall or fell in 2010.
Ans. SELECT DAYOFWEEK('2010-11-24');
8. Write the output that the following statements will produce:
a) SELECT ROUND(7.3456, 2);
b) SELECT TRUNCATE(2.3456, 2);
c) SELECT DAYOFMONTH('2009-08-25');
d) SELECT MONTH('2010-02-26');
e) SELECT RIGHT('Informatics', 4);
Ans. a) 7.35
b) 2.34
c) 25
d) 2
e) tics
Lab Exercises
1. Create the following table named "Charity" and write SQL queries for the tasks
that follow:
Table : Charity
P_ID LastName FirstName Address City Contribution
1 Bindra Jaspeet 5B, Gomti Nagar Lucknow 3500.50
2 Rana Monica 21 A, Bandra Mumbai 2768.00
3 Singh Jatinder 8, Punjabi Bagh Delhi 2000.50
4 Arora Satinder K/1,Shere Mumbai 1900.00
Punjab Colony
5 Krishnan Vineeta A-75,Adarsh
Nagar
i) Display all first names in lowercase.
ii) Display all last names of people of Mumbai city in uppercase.
iii) Display Person Id along with First 3 characters of his/her name.
iv) Display first name concatenated with last name for all the employees.
v) Display length of address along with Person ID.
vi) Display last 2 characters of City and Person ID.
vii) Display Last Names and First names of people who have "at" in the
second or third position in their first names.
viii) Display the position of „a‟ in Last name in every row.
ix) Display Last Name and First name of people who have "a" as the last
character in their First names.
x) Display the first name and last name concatenated after removing the
leading and trailing blanks.
xi) Display Person Id, last names and contribution rounded to the nearest
rupee of all the persons.
Chapter 1:Quering and SQL Functions 33 | P a g e
Pr ep ar ed b y : T ap o sh Kar mak ar AIR F OR CE S CH OO L J O RHA T | Mob il e : 70 0 20 70 31 3
Lat e st Up d a te on : 1 6 Ju l y 20 2 4
Class Notes :2024-25
xii) Display Person Id, last name and contribution with decimal digits
truncated of all the persons.
xiii) Display Last name, contribution and a third column which has
contributiondivided by 10. Round it to two decimal points.
Ans. SQL command to creating table “Charity”-
CREATE TABLE CHARITY
(
P_ID int Primary Key,
LastName varchar(30),
FirstName varchar(30),
Address varchar(50),
City varchar(20),
Contribution decimal(10,2)
);
SQL command to Inserting data to the table “Charity”-
2. Consider the table "Grocer" and write SQL queries for the tasks that follow:
Table: Grocer
i)
Display Item name, unit price along with Date of purchase for all the
Items.
ii) Display Item name along with Month (in number) when it was purchased
for all the items.
iii) Display Item name along with year in which it was purchased for all the
items.
iv) Display Item Id, Date of Purchase and day name of week (e.g. Monday) on
which it was purchased for all the items.
v) Display names of all the items that were purchased on Mondays or
Tuesdays.
vi) Display the day name of the week on which Rice was purchased.
vii) Display the Item name and unit price truncated to integer value (no
decimal digits)of all the items.
viii) Display current date
Ans. SQL command to creating table “Grocer”-
i) Display Item name, unit price along with Date of purchase for all the Items.
SELECT ItemName, UnitPrice, Date_Purchase FROM Grocer;
ii) Display Item name along with Month (in number) when it was purchased for all
the items.
SELECT ItemName, Month(Date_Purchase) FROM Grocer;
iii) Display Item name along with year in which it was purchased for all the items.
SELECT ItemName, YEAR(Date_Purchase) FROM Grocer;
iv) Display Item Id, Date of Purchase and day name of week (e.g. Monday) on which
it was purchased for all the items.
SELECT ItemName, Date_Purchase, Dayname(Date_Purchase) FROM Grocer;
v) Display names of all the items that were purchased on Mondays or Tuesdays.
SELECT * FROM Grocer
WHERE Dayname(Date_Purchase) IN („Monday‟,‟Tuesday‟);
vi) Display the day name of the week on which Rice was purchased.
SELECT ItemName, dayname(Date_Purchase) FROM Grocer
WHERE ItemName like „Rice‟;
vii) Display the Item name and unit price truncated to integer value (no decimal
digits) of all the items.
SELECT ItemName, Truncate(UnitPrice) FROM Grocer;
Write SQL commands for the tasks 1 to 35 and write the output for the SQL
commands 36to 40:
Simple Select
4. Display the details of all the loans.
5. Display the AccNo, Cust_Name, and Loan_Amount of all the loans.
Using NULL
9. Display the details of all the loans whose rate of interest is NULL.
10. Display the details of all the loans whose rate of interest is not NULL.
Using IN Operator
19. Display the Cust_Name and Loan_Amount for all the loans for which the number
ofinstalments are 24, 36, or 48. (Using IN operator)
Using BETWEEN Operator
20. Display the details of all the loans whose Loan_Amount is in the range 400000
to500000. (Using BETWEEN operator)
21. Display the details of all the loans whose rate of interest is in the range 11% to
12%.(Using BETWEEN operator)
31. Increase the interest rate by 0.5% for all the loans for which the loan amount is
morethan 400000.
32. For each loan replace Interest with (Loan_Amount*Int_Rate*Instalments)
12*100.
33. Delete the records of all the loans whose start date is before 2007.
34. Delete the records of all the loans of 'K.P. Jain'
35. Add another column Category of type CHAR(1) in the Loan table.