oop_exp8,9
oop_exp8,9
#CODE
select abs(22);
select abs(-22);
select mod(10,4);
select mod(10,4) as reminder;
select mod(15,3) as reminder;
select mod(15.6,2) as reminder;
select power(4,2);
select pow(12,2) as power;
select sqrt(4);
select sqrt(169) as square_root;
select greatest(2,5,18,6,12,100,65);
select least(2,5,18,6,12,100,65);
select least(2,5,18,6,12,100,65) as min;
select truncate(22.897,1);
select truncate(22.897,2);
select round(22.897,0);
#table
create database db47;
use db20;
#group by
select city,count(stu_id) as total_students from student group by city;
#having
select city,count(stu_id) as total_stds from student group by city having count (stu_id)>2;
#order by
select * from student order by city;
select * from student order by city desc;
#string functions
select upper('India') as upper_case;
select lower('INDIA') as lower_case;
select lcase('INDIA') as lower_case;
select character_length('India') as total_length;
select reverse("India");
select reverse(stu_name) from student;
select ascii('a');
select ascii('u');