Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Class XII IP MySQL Functions Assignment-II

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

GOLDEN HARRIER SCHOOL

Informatics Practices
Class XII
Assignment-II
MySQL Functions

1. Predict the output of the following queries:


i. select length(“ALAN TURING & ENIGMA”);
ii. select mid(“COMPUTER SCIENCE”,3);

2. Briefly explain the purpose of the following SQL functions:


i. trim()
ii. substr()

3. Help raj in predicting the output of the following queries:


i) select mod(20,3);
ii) select round(17.76);

4. Consider the table stock given below:

ItemCode Type Company Price Units


M008 Smart Phone Micromax 12000 25
L005 Laptop Acer 38500 12
M009 Smart Phone Samsung 20000 23
L003 Laptop Lenovo 55000 07
T006 Tablet Acer 17000 35
L019 Laptop Samsung 42000 15

Write SQL commands to:


a. To display companies name in uppercase without duplication
b. To display the average price of smartphones

5. Based on above table Stock, Predict the output for the following
a. SELECT MIN(PRICE) AS ‘LOWEST PRICE’ FROM STOCK;
b. SELECT LEFT(UCASE(COMPANY),2) FROM STOCK;

6. Alan created a table student with fields, rollno, name, sub and marks. And he wrote the
following commands and generated output

Command1: Select count(*) from student;


Output 1: 10
Command2: Select count(marks) from student;
Output 2: 7
Command3: Select sum(marks) from student;
Output 3: 700

What could be reason for variation in outputs of command 1 and command 2


Predict the output of following command

Command4: Select avg(marks) from student;


Output4 : ?

Write output of the following queries:


a) SELECT LEFT("INDIAN",2), RIGHT("SUPER COMPUTERS",5);
b) SELECT ROUND(124.25,-1), POW(2,3);
c) SELECT LENGTH(SUBSTR(“SQL IS SIMPLE”,4,5)) ;

8. Vaishnav was studying about MySQL Functions and he got confused between the
aggregate functions and scalar functions. Help him to distinguish between the same with
the help of examples.

9. Write queries to perform the following tasks


a) To display current day and day name from system date.
b) To display occurrence of the word ASC From the string “APS ASC Bangalore”.
c) To remove table “test” from database mydb;

10. Consider the table emp given and answer the following questions:
Table: Emp
EMP_ID EMP_NAME DEPT PAY ALLOWANCE
E001 ANKITA DEVELOPMENT 55000 5000
E002 SUSHANT R&D 45000 4000
E003 VINOD DEVELOPMENT 50000 5000
E004 MOHITHA DESIGN 40000 4000
E005 SHIVA R&D 50000 5000

a) To display total salary of R&D department as ‘R&D Total Paid’


b) To display highest salary and highest allowance in each department
c) To display no. of characters in department whose employee name ends with A
d) To display department and department wise average salary if there are more than 1
employee.
7.

You might also like