Untitled

 avatar
unknown
plain_text
a year ago
2.3 kB
24
Indexable
29/01/2024:

--where clause:
where clause is used for filter the record.
It is used for fetch only those records that satsfy the specific condition.
syntax:
select * from tablename where condition.

exa:-- select * from employeeinfo;
-- where
-- select * from employeeinfo where address="pune"
-- select * from employeeinfo where salary=30000
-- select * from employeeinfo where salary>30000
-- select * from employeeinfo where address !="pune";
-- select * from employeeinfo where address <> "pune";
-- select * from employeeinfo where salary between 30000 and 50000;
select * from employeeinfo where address in ("nagpur" ,"nashik")
-----------------------------------------------------------------------------------------
operators used in where clause:
1 equal to(=)
2 less than (<)
3,greater than(>)
4. greater than equal to (>=)
4. less than equal to (<=)
5. not equal to (!=,<>)
6.between (fetch records in certain range)
7.in (fetch specific multiple value)
8. like:- like operator is used to serch specific pattern.
9. and :- when both condition is true
10. or :- when  both or any one condition is true.
11. not : reverse 

exa: -- select * from employeeinfo where name like "ni%";
-- select * from employeeinfo where address like "%ded"
-- select * from employeeinfo where address like "%u%"
-- select * from employeeinfo where address like "pun_"
select * from employeeinfo where address like "pu__"

-- select * from employeeinfo where address ="nanded" and salary ="50000";
-- select * from employeeinfo where address ="nanded" or salary ="30000"
select * from employeeinfo where not name ="ram";

-----------------------------------------------------------------------------------------------
assignment:-

table name:EmployeeInfo 
EmpID	EmpFname	EmpLname	Department	Address	     Gender	Salary
1	Sanjay	         Mehra	          HR	        Hyderaba	M	500000
2	Ananya	         Mishra	         Admin	          Delhi	         	75000
3	Rohan	         Diwan	        Account	          Mumbai	M	90000
4	Sonia	        Kulkarni	  HR	         Hyderabad	F	85000
5	Ankit	         Kapoor	         Admin	          Delhi	        M	300000


Q1.first create table then insert values

Q2. Write a query to find the names of employees that begin with ‘S’




Editor is loading...
Leave a Comment