SQL WHERE Clause
TUTORIAL IN HINDI:
- WHERE clause is used to filter records.
- It is used to extract only those records that fulfill a specified condition.
- The SQL WHERE clause is used to specify a condition while fetching the data from a single table or by joining with multiple tables.
- If the given condition is satisfied, then only it returns a specific value from the table.
- You should use the WHERE clause to filter the records and fetching only the necessary records.
- The WHERE clause is not only used in SELECT statements, it is also used in UPDATE, DELETE.
SYNTAX:
SELECT column1, column2, ......., columnN
FROM Table_Name
WHERE [condition]
Operators in The WHERE Clause
The following operators can be used in the WHERE clause:
Operator Description
= Equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
<> OR != Not equal.
BETWEEN Between a certain range
LIKE Search for a pattern
IN To specify multiple possible values for a column
EXAMPLE:
SELECT ID, NAME, AGE
FROM STUDENT
WHERE NAME = 'Aniket';
The SQL SELECT DISTINCT Statement
TUTORIAL IN HINDI:
The SELECT DISTINCT statement is used to return only distinct (different) values.
Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.
Example:
SELECT DISTINCT Student_City From STUDENT;
--------------------------------------------------------------------------------------------
SQL:
- The Structured Query Language (SQL) is the language of databases.
- All modern relational databases, including Access, FileMaker Pro, Microsoft SQL Server and Oracle use SQL as their basic building block.
- In fact, it’s often the only way that you can truly interact with the database itself.
- All of the fancy graphical user interfaces that provide data entry and manipulation functionality are nothing more than SQL translators.
- They take the actions you perform graphically and convert them to SQL commands understood by the database.
- SQL is Similar to English
- Fortunately, at its core, SQL is a simple language.
- It has a limited number of commands and those commands are very readable and are almost structured like English sentences.
SQL Commands:
SQL commands are instructions. It is used to communicate with the database. It is also used to perform specific tasks, functions, and queries of data.
--------------------------------------------------------------------------------------
0 Comments