To select the rows meeting only certain criteria, use WHERE clause.
Syntax:
SELECT col1,col2 FROM table1 WHERE conditon1 AND/OR condition2 .....
SELECT col1,col2 FROM table1 WHERE (col1='123' and col2='456') OR col3='4';
Operators:
Example:
select * from deptt where depcity = 'Mumbai';
select * from emp where empsal > 2300;
select * from emp where empsal between 2400 and 2600;
All these operators can be used on the number as well as strings. When needed, numbers are implicitly converted into strings before comparison.
select * from deptt where depid like '%3%';
select * from deptt where depid like '%x%';
select * from deptt where depid = 'hello';
This 'where' clause can be used in insert/update/delete statements too.
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Answer is not availble for this assesment
Please login to comment
1 Comment
How to filter data Between two dates.. I am getting syntax error. Do we have to convert date as we did in insert..
Upvote Share