MIN() function
returns the smallest value of the selected column.
SELECT Min(EmpId)
FROM Employee
WHERE City= ‘Delhi’;
MAX() function
returns the largest value of the selected column.
SELECT Max(EmpId)
FROM Employee
WHERE City= ‘Delhi’;
COUNT() function
returns the number of rows that matches a specific condition
SELECT Count(EmpId)
FROM Employee
WHERE City= ‘Delhi’;
AVG() function
returns the average value of a numeric column.
SELECT Avg(Salary)
FROM Employee
WHERE City= ‘Delhi’;
SUM() function
returns the total sum of a numeric column
SELECT Sum(Salary)
FROM Employee
WHERE City= ‘Delhi’;
IN Operator
IN operator
allows you to specify multiple values in a WHERE clause
SELECT *
FROM Employee
WHERE City IN
(‘Delhi’,’Mumbai’;
BETWEEN operator
BETWEEN operator
selects values within a given range. The values can be numbers, text, or dates.
SELECT *
FROM Employee
WHERE EmpId BETWEEN 50 AND
100;
SQL aliases
SQL
aliases are used to give a table or a column a temporary name.
Field
name can identified or used by its alias name within the query
SELECT EmpId AS Id,
Name AS Nm,
FROM Employee A
WHERE EmpId >= 100;
No comments:
Post a Comment