Class XII | SQL Functions Output Assignment
1. Select power(5,2); 21. Select mid('modem',-3);
2. Select mod(7,3); 22. Select instr('computer','ter');
3. Select round(258.56); 23. Select instr('television','e');
4. Select round(258.56,1); 24. Select now();
5. Select round(258.56,2); 25. Select date(now());
6. Select round(258.56,3); 26. Select day(now());
7. Select round(258.56,-1); 27. Select dayname(now());
8. Select ucase('Computer'); 28. Select month(now());
9. Select lower('Computer'); 29. Select monthname(now());
10. Select length('white'); 30. Select year(now());
11. Select length('Ken Adams'); 31. Select power(2,mod(15,4));
12. Select left('information',4); 32. Select lcase(substr('Compass',-4));
13. Select right('information',6); 33. Select left('database',power(2,2));
14. Select ltrim(' Lisa '); 34. Select mod(21,length('table'));
15. Select rtrim(' Lisa '); 35. Select power(3,length('top'));
16. Select trim(' Lisa '); 36. Select monthname("2022-10-15");
17. Select trim(' Lisa Kudrow '); 37. Select date("2022-10-15");
Class XII | SQL Functions Output Assignment
18. Select substr('bottle',2,3); 38. Select round(68.7,mod(35,2));
19. Select substr('router',-4,2); 39. Select mod(10,instr('computer','omp'));
20. Select mid('string',3); 40. Select mid('information',round(2.9),power(2,2));
Class XII | SQL Functions Output Assignment
Table : ORDERS
1. select right(customer, 5) from orders;
2. select round(10/100*OrderPrice,1) ‘GST’ from orders;
3. select insrt(customer,’a’) from orders;
4. select customer from orders where OrderDate > 2020/12/31;
5. select count(*) from orders;
6. select count(*) from orders where OrderPrice<1200;
7. select customer, count(*) ‘number of orders’ from orders group by customer;
8. select avg(OrderPrice) from orders;
9. select month(OrderDate) from orders where O_ID = 4;
10. select ucase(customer) from orders;
1. select Location, sum(SalesAmt) from store group by city;
2. select Name, Location, sum(SalesAmt) from store group by city having SalesAmt >
40000;
3. select Name, avg(SalesAmt) from store where name like '%fashion%';
4. select Name, sum(SalesAmt) from store where city=’Delhi’;
5. select min(DateOpen) from store;
6. select City count(*), from store;
7. select max(monthname(DateOpen)) from store;
8. select location from store whereSalesAmt=60000;
9. select length(city) from store where NoofEmp = 11;
10. select lower(location) from store where city = ‘Delhi’;
Class XII | SQL Functions Output Assignment
1).
mysql> select power(5,2);
+------------+
| power(5,2) |
+------------+
| 25 |
+------------+
1 row in set (0.01 sec)
2).
mysql> select mod(7,3);
+----------+
| mod(7,3) |
+----------+
| 1|
+----------+
1 row in set (0.00 sec)
3).
+---------------+ mysql> select round(258.56);
+---------------+
| round(258.56) |
| 259 |
+---------------+
4).
mysql> select round(258.56,1);
+-----------------+
Class XII | SQL Functions Output Assignment
| round(258.56,1) |
+-----------------+
| 258.6 |
+-----------------+
1 row in set (0.00 sec)
5).
mysql> select round(258.56,2);
+-----------------+
| round(258.56,2) |
+-----------------+
| 258.56 |
+-----------------+
1 row in set (0.00 sec)
6).
mysql> select round(258.56,3);
+-----------------+
| round(258.56,3) |
+-----------------+
| 258.560 |
+-----------------+
1 row in set (0.00 sec)
7).
mysql> select round(258.56,-1);
+------------------+
| round(258.56,-1) |
+------------------+
Class XII | SQL Functions Output Assignment
| 260 |
+------------------+
1 row in set (0.04 sec)
8).
mysql> select ucase("computer");
+-------------------+
| ucase("computer") |
+-------------------+
| COMPUTER |
+-------------------+
1 row in set (0.02 sec)
9).
mysql> select lower("Computer");
+-------------------+
| lower("Computer") |
+-------------------+
| computer |
+-------------------+
1 row in set (0.00 sec)
10).
mysql> select length("white");
+-----------------+
| length("white") |
+-----------------+
| 5|
+-----------------+
Class XII | SQL Functions Output Assignment
1 row in set (0.00 sec)
11).
mysql> select length("ken adams");
+---------------------+
| length("ken adams") |
+---------------------+
| 9|
+---------------------+
1 row in set (0.00 sec)
12).
mysql> select left("information",4);
+-----------------------+
| left("information",4) |
+-----------------------+
| info |
+-----------------------+
1 row in set (0.00 sec)
13).
mysql> select right("information",6);
+------------------------+
| right("information",6) |
+------------------------+
| mation |
+------------------------+
1 row in set (0.00 sec)
14).
Class XII | SQL Functions Output Assignment
mysql> select ltrim(" lisa ");
+---------------------+
| ltrim(" lisa ") |
+---------------------+
| lisa |
+---------------------+
1 row in set (0.10 sec)
15).
mysql> select rtrim(" lisa ");
+---------------------+
| rtrim(" lisa ") |
+---------------------+
| lisa |
+---------------------+
1 row in set (0.03 sec)
16).
mysql> select trim(" lisa ");
+------------------+
| trim(" lisa ") |
+------------------+
| lisa |
+------------------+
1 row in set (0.00 sec)17).
17).
mysql> select trim(" lisa kudrow ");
+-------------------------+
Class XII | SQL Functions Output Assignment
| trim(" lisa kudrow ") |
+-------------------------+
| lisa kudrow |
+-------------------------+
1 row in set (0.00 sec)
18).
mysql> select substr("bottle",2,3);
+----------------------+
| substr("bottle",2,3) |
+----------------------+
| ott |
+----------------------+
1 row in set (0.00 sec)
19).
mysql> select substr("router",-4,2);
+-----------------------+
| substr("router",-4,2) |
+-----------------------+
| ut |
+-----------------------+
1 row in set (0.00 sec)
20).
mysql> select mid("string",3);
+-----------------+
| mid("string",3) |
+-----------------+
Class XII | SQL Functions Output Assignment
| ring |
+-----------------+
1 row in set (0.00 sec)
21).
mysql> select mid("modem",-3);
+-----------------+
| mid("modem",-3) |
+-----------------+
| dem |
+-----------------+
1 row in set (0.00 sec)
22).
mysql> select instr("computer","ter");
+-------------------------+
| instr("computer","ter") |
+-------------------------+
| 6|
+-------------------------+
1 row in set (0.00 sec)
23).
mysql> select instr("television","e");
+-------------------------+
| instr("television","e") |
+-------------------------+
| 2|
+-------------------------+
Class XII | SQL Functions Output Assignment
1 row in set (0.00 sec)
24).
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2022-03-28 10:16:22 |
+---------------------+
1 row in set (0.00 sec)
25).
mysql> select date(now());
+-------------+
| date(now()) |
+-------------+
| 2022-03-28 |
+-------------+
1 row in set (0.03 sec)
26).
mysql> select day(now());
+------------+
| day(now()) |
+------------+
| 28 |
+------------+
1 row in set (0.01 sec)
27).
Class XII | SQL Functions Output Assignment
mysql> select dayname(now());
+----------------+
| dayname(now()) |
+----------------+
| Monday |
+----------------+
1 row in set (0.03 sec)
28).
mysql> select month(now());
+--------------+
| month(now()) |
+--------------+
| 3|
+--------------+
1 row in set (0.04 sec)
29).
mysql> select monthname(now());
+------------------+
| monthname(now()) |
+------------------+
| March |
+------------------+
1 row in set (0.02 sec)
30).
mysql> select year(now());
+-------------+
Class XII | SQL Functions Output Assignment
| year(now()) |
+-------------+
| 2022 |
+-------------+
1 row in set (0.00 sec)
31).
mysql> select power(2,mod(15,4));
+--------------------+
| power(2,mod(15,4)) |
+--------------------+
| 8|
+--------------------+
1 row in set (0.00 sec)
32).
mysql> select lcase(substr("COMPASS",-4));
+-----------------------------+
| lcase(substr("COMPASS",-4)) |
+-----------------------------+
| pass |
+-----------------------------+
1 row in set (0.00 sec)
33).
mysql> select left("database",power(2,2));
+-----------------------------+
| left("database",power(2,2)) |
+-----------------------------+
Class XII | SQL Functions Output Assignment
| data |
+-----------------------------+
1 row in set (0.02 sec)
34).
mysql> select mod(21,length("table"));
+-------------------------+
| mod(21,length("table")) |
+-------------------------+
| 1|
+-------------------------+
1 row in set (0.00 sec)
35).
mysql> select power(3,length("top"));
+------------------------+
| power(3,length("top")) |
+------------------------+
| 27 |
+------------------------+
1 row in set (0.00 sec)
36).
mysql> select monthname("2022-10-15");
+-------------------------+
| monthname("2022-10-15") |
+-------------------------+
| October |
+-------------------------+
Class XII | SQL Functions Output Assignment
1 row in set (0.00 sec)
37).
mysql> select date("2022-10-15");
+--------------------+
| date("2022-10-15") |
+--------------------+
| 2022-10-15 |
+--------------------+
1 row in set (0.00 sec)
38).
mysql> select round(68.7,mod(35,2));
+-----------------------+
| round(68.7,mod(35,2)) |
+-----------------------+
| 68.7 |
+-----------------------+
1 row in set (0.00 sec)
39).
mysql> select mod(10,instr('computer','omp'));
+---------------------------------+
| mod(10,instr('computer','omp')) |
+---------------------------------+
| 0|
+---------------------------------+
40).
Class XII | SQL Functions Output Assignment
mysql> select mid("information",round(2.9),power(2,2));
+------------------------------------------+
| mid("information",round(2.9),power(2,2)) |
+------------------------------------------+
| form |
+------------------------------------------+
1 row in set (0.00 sec)