SQL server is the most popular database of Microsoft company which was develop in 1989. SQL stands for Structure Query Language. It is RDBMs so in this case record is store in tabular format. It is platform dependent because it runs only on windows operating system.
WHERE clause
A WHERE clause in SQL is a data manipulation language statement. WHERE clauses are not mandatory clauses. it filters the records. WHERE clause is use in SELECT, UPDATE, DELETE statement is knows as Where Clause.
Syntax
SELECT column1, column 2, ... column n FROM table_name WHERE [conditions]
Operators
some Operators in The WHERE Clause are following:-
Operator | Description |
= | Equal |
> | Greater than |
< | Less than |
>= | Greater than or equal |
<= | Less than or equal |
<> | Not equal |
BETWEEN | Between a certain range |
LIKE | Search for a pattern |
IN | To specify multiple possible values for a column |
Example of Where Clause Query
SELECT * FROM test.student_details where Student_Name ="Anuj";
Output of Where Clause Query
SQL AND Clause Query
The Where clause can be combined with AND operators. Operators are use to filter records based on more than one condition is knows as AND Clause Query.
Syntax
SELECT column1, column2, ... FROM table_name WHERE condition1 AND condition2 AND condition3 ...;
Example of SQL AND Clause Query
SELECT * FROM test.person3 where phone="784551236" AND Name="A";
Output of SQL AND Clause Query
OR Clause Query
The OR clause can be combined with OR operators. Operators are use to filter records based on more than one condition is knows as OR Clause Query.
Syntax
SELECT column1, column2, ... FROM table_name WHERE condition1 OR condition2 OR condition3 ...;
Example of OR Query
SELECT * FROM test.person3 where phone="784551236" or Name="A";
Output of OR Query
SQL SELECT AS
SQL ‘AS’ is use to assign a new name temporarily. command is use to rename a column with an alias is knows SQL SELECT AS.
Syntax
SELECT Column_Name1 AS New_Column_Name, Column_Name2 As New_Column_Name FROM Table_Name;
If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.
To know more about SQL please Wikipedia click here .
Stay Connected Stay Safe, Thank you
0 Comments