MySQL where clause

Explain the use of Where clause by providing examples for the following.

1. Using Where clause
2. Using the IN operator
3. Using the NOT Operator
4. Using no value, i.e. NULL

Where Clause can be used as a predicate to specify some condition to fetch data.

Using Where clause
Select * from employee Where emp_salary > 1000;

Using the IN operator
SELECT * FROM Persons WHERE LastName IN ('Hansen','Pettersen')

Using the NOT Operator
SELECT * FROM employee WHERE employee_name not in ( 'IBM', 'Hewlett Packard', 'Microsoft');

Using no value, i.e. NULL
Create table employee(Emp_id integer (10) NOT NULL, Emp_name varchar(255),);
MySQL operator - AND, OR and IN operator
MySQL operator - The LIKE operator is used to search for a specified pattern in a column.
MySQL searching using regular expression
MySQL searching - basic character matching using REGEXP in MySQL, matching of several characters at a time
MySQL concatenating fields
MySQL concatenating fields - use of Concat() functions
Post your comment

You may like