Operator in Sql Queries
SQL stands for Structured Query Language It can access and manipulate databases. It is an ANSI (American National Standards Institute) standard.
Even Though SQL is an ANSI, there are many different versions of the SQL language.
They all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
Sql Server is a Relational Database Management System.It is stored in database objects called tables.A table consists of columns and rows.
Top Operator:
Using this Query you can fetch top records from table according to your need.. please find below QueryExample:
SELECT TOP number FROM table_nameLIKE Operator:
Like Operator is to search the specific pattern from a column Example:
SELECT * FROM table_name WHERE column_name LIKE 's%'IN Operator:
It can Specify multiple value in where clauseExample
SELECT column_name(s) FROM table_name WHERE column_name IN (value1,value2,...)BETWEEN Operator:
It Select the data at the range of two valueExample
SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2Alias Operator:
We can use alias name for table or columnExample for Table
SELECT column_name(s) FROM table_name AS alias_name Example for Column
SELECT column_name AS alias_name FROM table_nameSQL JOINS
Join keyword is used to combine the two table or more table. according to the relationship..Different Types Of Joins
1)LEFT JOIN
2)RIGHT JOIN
3)FULL JOINInner Join
The INNER JOIN return rows when there is least one match in both tables.Example
SELECT column_name(s)
FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_nameLeft Join
It return all the row in left table even there is no matches in right tableExample
SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_nameRight Join
It return all the table right table even there is no matches in left tableExample
SELECT column_name(s)
FROM table_name1
RIGHT JOIN table_name2
ON table_name1.column_name=table_name2.column_nameFull Join
The FULL JOIN return rows when there is a match in one of the tables.Example
SELECT column_name(s)
FROM table_name1
FULL JOIN table_name2
ON table_name1.column_name=table_name2.column_name