SQL where statement

In this chapter you will learn:
where statement
Syntax of where statement
Example of where statement

About where statement

SQL where statement is also known as where clause which is used to retrieve data with a condition. If the table of the database will fulfill the statement then you will retrieve the data otherwise it will raise an error.

Syntax of where statement

1. Select * from table_name where condition
2. Select column_name1, column_name2…. where condition

Example of where statement

select * from humanresources.employee where employeeid=1
Guide:

In the given example where clause is used to retrieve the employee details whose employee id is 1 so it only displays only one record. The output is given for your better guide so try to run the given command in your system and match the output.

image of where statement
SUMMARY

In this chapter, you have learned about where clause or statement so try to use yourself. In the next chapter you will learn about AND & OR statement.

 

Share your thought