Select Query: Select Column List From Tablename Where Conditions
Select Query: Select Column List From Tablename Where Conditions
FROM tableName
WHERE conditions;
• FROM selects the table(s) that the query is going to use to produce the
resulting information
Fig 1.1
SELECT ALL without WHERE condition.
Using the syntax SELECT * FROM [TableName]; will display all the values
inserted inside the said table.
1|Page
Fig 1.2
SELECT Specific Column without WHERE condition.
Fig 1.3
SELECT All Column with WHERE condition.
The WHERE clause is used to filter records. It is used to extract only those
records that fulfill a specified condition.
2|Page
The following operators can be used in the WHERE clause:
SYMBOL Meaning
= Equal to
The WHERE clause can also be combined with AND, OR, and NOT operators.
The AND and OR operators are used to filter records based on more than
one condition:
Fig 2.1
SELECT All Column with WHERE condition Combined
with AND logical Operator.
3|Page
Fig 2.2
SELECT All Column with WHERE condition Combined
with AND logical Operator.
Both Figure 2.1 and Figure 2.2 show a SELECT ALL statement with WHERE
clause combined with And Logical Operator the only difference is in Figure
2.1 both conditions in WHERE clause returns TRUE that’s why it displays an
output of 1 row while in Figure 2.2 the condition returns only one true
answer.
Fig 2.3
SELECT All Column with WHERE condition Combined
with OR logical Operator.
4|Page
The NOT operator displays a record if the condition(s) is NOT TRUE.
Fig 2.4
SELECT All Column with WHERE condition Combined
with NOT logical Operator.
Wildcard characters are used with the SQL LIKE operator. The LIKE operator is used in
a WHERE clause to search for a specified pattern in a column.
There are two wildcards used in conjunction with the LIKE operator:
5|Page
_ - The underscore represents a single character
Fig 2.4
SELECT All Column with WHERE condition Combined
with LIKE Special Operator.
The query states that it should display or view all details in the table which has
Name that starts with any character and ends with ‘ead’.
6|Page