Menu

Tuesday, 4 March 2014

LCase() Lower Case Function In SQL Server



It is used to write all characters in small letter.

EmployeeID
EmployeeName
1
Mayank Dixit
2
Mona Dixit
3
Purnima
4
Payal

In the above table (employee), we want to write all characters (EmployeeName) in small letter.

Syntax

SELECT { fn LCASE(Column_Name) } AS Alias_Column_Name
FROM Table_Name;

Example

SELECT { fn LCASE(EmployeeName) } AS Name_OF_Employee
FROM Employee;

Here Name_OF_Employee is a subname (alias) of column.

Output:-

Name_OF_Employee
mayank dixit
mona dixit
purnima
payal

UCase() Upper Case function in SQL Server



It is used to write characters in capital letter.

EmployeeID
EmployeeName
1
Mayank Dixit
2
Mona Dixit
3
Purnima
4
Payal

In the above table (employee), we want to write all characters (EmployeeName) in capital letter.

Syntax

SELECT { fn UCASE(Column_Name) } AS Alias_Column_Name
FROM Table_Name;

Example

SELECT { fn UCASE(EmployeeName) } AS Name_OF_Employee
FROM Employee;

Here Name_OF_Employee is a subname (alias) of column.

Output:-
Name_OF_Employee
MAYANK DIXIT
MONA DIXIT
PURNIMA
PAYAL

Thursday, 27 February 2014

SUM() Function



It is used to calculate total sum of numeric column.

EmployeeID
EmployeeName
EmployeeMobNo
EmployeeSalary
1
Mayank Dixit
9532771738
20000
2
Mona Dixit
9005408263
15000
3
Purnima
9485754875
26522
4
Payal
9785458545
19856
                                                       employee

In the above table (employee), we want to calculate total sum of salary of employee (EmployeeSalary).

Syntax

SELECT SUM(Column_Name) AS Alias_Column_Name
FROM Table_Name;

Example

SELECT SUM(EmployeeSalary) AS Total_Salary_OF_Employee
FROM Employee;

Here Total_Salary_OF_Employee is a subname (alias) of column.

Output:-
Total_Salary_OF_Employee
81378