SQL FUNCTIONS WORKSHEET
XII IP
1. Write the output of the following SQL queries:
SELECT RIGHT (‘software’, 2);
SELECT INSTR (‘twelve’, lV);
SELECT DAYOFMONTH (‘2014-03-01’);
SELECT (76.987,2);
SELECT ROUND(144.23,-1);
SELECT ROUND(1449.58-2);
SELECT ROUND(7.5789,3);
SELECT SUBSTR( “HELLO RAHUL’,3,8);
SELECT DAYOFMONTH (“2020-10-24”);
SELECT ROUND(55.698,2);
SELECT MID(‘EXAMINATION’,4,4);
SELECT ROUND(4562.778-2);
SELECT LENGTH(TRIM( ‘EXAM’ ));
SELECT SUBSTRING(‘MYSQL APPLICATION,3,3);
SELECT INSTR(‘MYSQL APPLICATION,’P’);
SELECT ROUND(7756.452,1);
SELECT ROUND(59999.99,-2);
SELECT RIGHT(‘MYSQL APPLICATION,3);
2. There is a column Salary in a Table EMPLOYEE. The following two statements are giving different
outputs. What may be the possible reason?
SELECT COUNT(*) FROM EMPLOYEE;
SELECT COUNT(SALARY) FROM EMPLOYEE;
Which function is not an example of single row function?
a) LOWER()
b) MID()
c) DAY()
d) MIN()
Which function is not an example of single row function?
a) LOWER()
b) MID()
c) DAY()
d) MIN()
3. Which is not an example of single row function?
a) Lower() b) Mid() c) Day() d) Min()
4. ________ command is used to open database,,Stock.
a) Select Stock; b) Use Stock; c) Show Stock; d) Select *From Stock;
5. Write SQL function that will display the day of month of given date.
6. Write a SQL functions to perform the followings-
a) To display position of the first occurrence of substring in a string.
b) To removes trailing spaces in the string/column
c) To display numeric month from the date passed
d) To display the date and time at which the function executes
7. What is the difference between COUNT() and COUNT(*)?
a) Display destination wise number of drivers available.
b) To display driver name who do not have any grade assigned.
c) To display destination where Television and Computer is transported.
8. Write SQL functions to perform the followings-
a) To display name of day of a date column
b) To display position of the first occurrence of substring in a string
c) To removes trailing spaces in the string/column
d) To display numeric month from the date passed
e) To display the date and time at whi
a) Display destination wise number of drivers available.
b) To display driver name who do not have any grade assigned.
c) To display destination where Television and Computer is transported.
8. Write SQL functions to perform the followings-
a) To display name of day of a date column
b) To display position of the first occurrence of substring in a string
c) To removes trailing spaces in the string/column
d) To display numeric month from the date passed
e) To display the date and time at whi