TSQL Functions
TSQL Functions
'''Numeric Functions'''
select abs(34.5);
select sin(90);
select cos(90);
select tan(90);
select exp(4);
select log(10);
select pi();
select sign(-2);
select sqrt(4);
select rand();
select ceiling(34.78);
select floor(34.78);
select degrees(90);
select radians(90);
select round(34.45566,1);
'''String Functions'''
Select ASCII('CSC');
Select CHAR(67);
select len('text');
select lower('SHAHIDHA');
select UPPER('shahidha');
select ltrim(' shahidha');
select rtrim('shahidha ');
select reverse('shahidha');
select replicate('shahidha',2);
select left('shahidha',3);
select right('shahidha',3);
select space(100);
select str(13.5);
select stuff('Shhaidha',2,4,'Begum');
'''Date Functions'''
select getdate();
select getdate()+5;
select day('3/3/2022');
select month('3/3/2022');
select year('3/3/2022');
'''System Functions'''
select db_name();
select db_id('sultan');
select host_name();
select datalength('shahidha');
select object_id('sultan');
select object_name('sultan');
select suser_id('sa');
select user_id(1);
select suser_name(1);
'''Aggregate Functions'''
use kabeer;
select * from student;
select avg(mark) from student;
select sum(mark) from student;
select count(mark) from student;
select count(*) from student;
select min(mark) from student;
select max(mark) from student;