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:-

OperatorDescription
=Equal
>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
<>Not equal
BETWEENBetween a certain range
LIKESearch for a pattern
INTo specify multiple possible values for a column

Example of Where Clause Query

SELECT * FROM test.student_details
where Student_Name ="Anuj";
Where Clause

Output of Where Clause Query

Where Clause

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";
Input

Output of SQL AND Clause Query

output

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";
Input

Output of OR Query

Output

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


Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *