Querying and Filtering data in
MySQL Table
Using MySQL SELECT statement to query
data
• Create a table employees
• Insert Multiple VALUES at a time
• Insert Single Values {Must have same values as attributes number}
• View data from table
• The SELECT DISTINCT statement is used to
return only distinct (different) values.
Filtering rows using MySQL WHERE
• MySQL WHERE for INETEGER type value
• MySQL WHERE for String type value
Using comparison operators
Operator Description
= Equal
•> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
<> Not equal. Note: In some versions of SQL this operator
may be written as !=
Using comparison operators (, <=,>=,
<>)
• Example-1
• Example-2
•
• MySQL AND operator examples
• MySQL OR operator examples
• MySQL NOT operator examples
• SELECT * FROM employees
WHERE NOT Lastname=‘Rahman';
SQL MIN() and MAX() Functions
• MIN()example
SELECT MIN(salary) AS SmallestPrice FROM
employees;
• Max()example
SELECT Max(salary) AS LargestPrice FROM
employees;