MS SQL Server: Beginner To Advance Tutorial
MS SQL Server: Beginner To Advance Tutorial
Most of the actions you need to perform on a database are done with SQL
statements
Example
Example
The
The SELECT
SELECTDISTINCT statement
statement is usedistoused to return
select only distinct
data from (different) values
a database.
Example
SELECT DISTINCT
SELECT * FROM column1, column2, ...
table_name;
FROM table_name;
SQL Select Statements
Example
Example
are TRUE
Example
is TRUE
Example
Example
descending order
Example
pattern in a column
Example
pattern in a column
Example
SELECT column1, column2, ...
FROM table_name
WHERE columnN LIKE pattern;
SQL Like Operator
The LIKE operator is used in a WHERE clause to search for a specified
pattern in a column
Example
SELECT column1, column2, ...
FROM table_name
WHERE columnN LIKE pattern;
SQL Like Operator
The LIKE operator is used in a WHERE clause to search for a specified
pattern in a column
Example
SELECT column1, column2, ...
FROM table_name
WHERE columnN LIKE pattern;
SQL Between
The BETWEEN operator selects values within a given range. The values can
Example
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN
value1 AND value2;
SQL Joins
A JOIN clause is used to combine rows from two or more tables, based on a
tables
Example
SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name = table2.
column_name;
Left Join
The LEFT JOIN keyword returns all records from the left table (table1), and
the matched records from the right table (table2). The result is NULL from
Example
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.
column_name;
Right Join
The RIGHT JOIN keyword returns all records from the right table (table2),
and the matched records from the left table (table1). The result is NULL
Example
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.
column_name;
Outer Join
The FULL OUTER JOIN keyword returns all records when there is a match in
Example
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.
column_name
WHERE condition;
Store Procedure
A stored procedure is a prepared SQL code that you can save, so the code
Example
CREATE PROCEDURE procedure_name
AS
sql_statement
GO;
Execute Store Procedure
EXEC procedure_name;
Thank YOU!
We Are Creating Content For You Free Of Cost