Select Sallery From Table Using MS SQL SERVER

Sum:

select sum(salary)as [Total salary] from table-name

Group by:

select sum(salary)as total from table-name group by salary
select ename,sum(salary)as total from tble group by ename

Maximum:

select max(salary)as total from table-name
select ename, max(salary)as total from table group by ename

Minimum:

select min(salary)as Minimum from table-name
select ename, min(salary)as total from table-name group by ename

Average:

select avg(salary)as Average from table-name
select avg(salary)as Average from table-name
where eno>8

Counting Records:

select count(*)as [number of records] fromtable-name

Square:

select square(salary)as [square] from tble

Square Root:

select sqrt(64)as [square root]

Absolute:

select abs(-64)as [Absolute]

Ceiling:

select ceiling(2.00661)as [Ceiling]

Floor:

select floor(2.012012)as [Floor]

Pi:

select pi() as [pi]

Power:

select power(3,2) as [power]
select power(salary,2) as [power] from table-name

Round:

select round(pi(),2) as [Round]
select round(SIN(30),5) as [Round]

Ascii:

select ascii('A') as [Ascii]

Length:

select len('Ajasdgaqberjlbn"p') as [length]

Time and date:

select current_timestamp as [date time]
 NOTE!
The red color text are table name that are you using and the blue are the builtin function

Thanks for visiting friends, if you have any question about it please contact us at our



0 comments: