0% found this document useful (0 votes)
1 views

Lesson 1.2 - SQL Fundamentals (Filtering Statements)

The document provides an overview of SQL statements focusing on filtering data using the WHERE clause, including conditions such as BETWEEN, IN, AND, OR, and NOT operators. It explains how to select specific columns from a table while applying filters to exclude or include certain data based on specified conditions. Additionally, it touches on sorting results using the ORDER BY clause in ascending or descending order.

Uploaded by

plaatjies.ipele
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Lesson 1.2 - SQL Fundamentals (Filtering Statements)

The document provides an overview of SQL statements focusing on filtering data using the WHERE clause, including conditions such as BETWEEN, IN, AND, OR, and NOT operators. It explains how to select specific columns from a table while applying filters to exclude or include certain data based on specified conditions. Additionally, it touches on sorting results using the ORDER BY clause in ascending or descending order.

Uploaded by

plaatjies.ipele
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

SQL Statements

Filtering

youcanfit eue
WHERE
the

statement
I
filtering
on
we do

SELECT WHERE statement

filter theor as
filtering
columns
A
you
by
the
not
mentioning
column
are base on a specific
condition
If do not mention
you
the column name in the
SELECT statement it will
be excluded
from
the final autput
Salary table
-

# HR
SELECT
Name
,

Salary
FROM
salary-table
WHERE 20000
Salary
>

# ~
Inclusive

[
BETWEEN comn-names

FROM table-name
SELECT Name
, WHERE columnname
Department, valuel
AND
BETWEEN
Salary valuez
FROM

WHERE -Salary
BETWEEN And
salary-table
column Start Included end
#m
Depart m /
as
~ you specify the

IN statement
Specific
need
thing
that
you
in specific
column

=>
(Durbani
prote
*
SELECT
FROM orders

WHERE City

~
lucludeswhatyou set a
SELECT productname
FROM orders
,

City Excludes
WHERE
city NOT IN ('Giyani

-
I
operator
-both
must
conditions
be meant
Loneo est th

be meant

T
AND operator Syntax limitted
SELECT not
column ,
columns ,

Columns , youhowmana
can
column

FROM table -
name

WHERE conditiona AND conditions. ......

OR operator
SELECT
column ,
columns ,

Columns ,

column

FROM table -
name

WHERE conditiona OR conditiona ........

NOT operator
SELECT column
,
Columna

FROM table - name

WHERE NOT condition . . .


ORDER By~ sortingent

From
/
largest
-

Smallest From Smallest-largest


Order
Desceding
order
Ascending
DESL ASC

SELECT column-names

FROM table -
name

ORDER BY column-name ASC ;


#
SELECTFROMSalaryT

#. .

You might also like