Task 5 - SQL WHERE Clause

Post Reply
User avatar
Mayank
Site Admin
Posts: 174
Status: Offline

Task 5 - SQL WHERE Clause

Post by Mayank » 11 Oct 2017, 12:19

The SQL WHERE ClauseThe WHERE clause is used to filter records.The WHERE clause is used to extract only those records that fulfill a specified condition.WHERE Syntax

Code: Select all

SELECT [i]column1[/i],[i] column2, ...[/i]
FROM [i]table_name[/i]
WHERE [i]condition[/i];
WHERE Clause ExampleThe following SQL statement selects all the customers from the country "Mexico", in the "Customers" table:Example

Code: Select all

SELECT * FROM Customers
WHERE Country='Mexico';
Try it Yourself »

Text Fields vs. Numeric FieldsSQL requires single quotes around text values (most database systems will also allow double quotes).
However, numeric fields should not be enclosed in quotes: Example

Code: Select all

SELECT * FROM Customers
WHERE CustomerID=1;
Try it Yourself »

Operators in The WHERE Clause

The following operators can be used in the WHERE clause: 

sql operators.png

Note: Use Demo database as of the previous Task
You do not have the required permissions to view the files attached to this post.
Mayank Goyal
Post Reply