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

SQL Functions Homework for Class XII

This document contains SQL commands and queries to practice functions in SQL. It provides 8 SQL commands to display customer information from a Loan_Accounts table in various ways using functions like LOWER, LENGTH, SUBSTR, etc. It also provides 5 multiple choice questions about SQL functions. The document includes sample output for 8 queries on the Loan_Accounts table and asks the student to write the output of 8 additional SQL statements testing functions like POW, ROUND, LENGTH, DATE functions etc.

Uploaded by

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

SQL Functions Homework for Class XII

This document contains SQL commands and queries to practice functions in SQL. It provides 8 SQL commands to display customer information from a Loan_Accounts table in various ways using functions like LOWER, LENGTH, SUBSTR, etc. It also provides 5 multiple choice questions about SQL functions. The document includes sample output for 8 queries on the Loan_Accounts table and asks the student to write the output of 8 additional SQL statements testing functions like POW, ROUND, LENGTH, DATE functions etc.

Uploaded by

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

Army Public School Yol Cantt

Informatics Practices - XII


Holidays Home work
Functions in SQL - 01

27 May – 31 May 2020

Write SQL commands for the following:


1. Display all customer names in lowercase.
3. Display length of column customer name.
4. Display last 3 characters of column customer name.
5. Display customer names of people who have "P" in the third position in their
names.
6. Display the position of 'a' in column customer name in every row.
7. Display account no and interest rate rounded off for all loan accounts
8. Display year from column start_date for all loan accounts.

Find the Output of the following queries


1. SELECT cust_name, LENGTH(Cust_Name), LCASE(Cust_Name),
UCASE(Cust_Name) FROM Loan_Accounts WHERE Int_Rate < 11.00;
2. SELECT LEFT(Cust_Name, 3), Right(Cust_Name, 3), SUBSTR(Cust_Name, 1, 3)
FROM Loan_Accounts WHERE Int_Rate > 10.00;
3. SELECT RIGHT(Cust_Name, 3), SUBSTR(Cust_Name, 5) FROM Loan_Accounts;
4. SELECT DAYNAME(Start_Date) FROM Loan_Accounts where instalments=60;
5. SELECT ROUND(Int_Rate*110/100, 1) FROM Loan_Account
WHERE Int_Rate > 10;

Write the output produced by the following SQL commands:


1. SELECT POW(4,3), POW(3,4);
2. SELECT ROUND(543.5694,2), ROUND(543.5694), ROUND(543.5694,-1);
3. SELECT LENGTH("Prof. M. L. Sharma");
4. SELECT YEAR(NOW()), MONTH(NOW()), DAY(NOW());
5. SELECT MONTHNAME(NOW()),DAYNAME(NOW());
Note: NOW() is 27 May 2020
6. SELECT LEFT("Unicode",3), RIGHT("Unicode",4);
7. SELECT INSTR("UNICODE","CO"), INSTR("UNICODE","CD");
8. SELECT MID("Informatics",3,4), SUBSTR("Practices",3);
Multiple Choice Questions
1) ________________functions operate on a single value to return a single value
(a) Multiple Row
(b) Aggregate
(c) Single Row
(d) Summation

2) SUM, AVG,COUNT are examples of ____________________functions.


(a) Date
(b) String
(c) Multiple Row
(d) Single Row

3) SELECT POW(-3,3) will display the output:


(a) 9
(b) -9
(c) 27
(d) -27

4) SELECT ROUND(7.956,2) will result in


(a) 7.95
(b) 7.96
(c) 8
(d) 8.0

5) INSTR(str,str2) returns the position of the first occurrence of


(a) Str in "MySQL"
(b) Str in str2
(c) str2 in str
(d) str2 in "SQL"

You might also like