Skip to content

Commit c41315d

Browse files
Update SQL_Class_3.txt
1 parent cbbfa7a commit c41315d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

SQL_Class_3.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,42 @@ select * from employee order by salary desc limit 1;
6868

6969
# Write a query to find the employee who is getting minium salary?
7070
select * from employee order by salary limit 1;
71+
72+
# Conditional Operators -> < , > , <= , >=
73+
# Logical Operator -> AND, OR, NOT
74+
75+
select * from employee;
76+
77+
# list all employees who are getting salary more than 20000
78+
select * from employee where salary>20000;
79+
80+
# list all employees who are getting salary more than or equal to 20000
81+
select * from employee where salary>=20000;
82+
83+
# list all employees who are getting less than 20000
84+
select * from employee where salary<20000;
85+
86+
# list all employees who are getting salary less than or equal to 20000
87+
select * from employee where salary<=20000;
88+
89+
90+
# filter the record where age of employees is equal to 20
91+
select * from employee where age=20;
92+
93+
# filter the record where age of employees is not equal to 20
94+
# we can use != or we can use <>
95+
select * from employee where age != 20;
96+
select * from employee where age <> 20;
97+
98+
# find those employees who joined the company on 2021-08-11 and their salary is less than 11500
99+
select * from employee where hiring_date = '2021-08-11' and salary<11500;
100+
101+
# find those employees who joined the company after 2021-08-11 or their salary is less than 20000
102+
select * from employee where hiring_date > '2021-08-11' or salary<20000;
103+
104+
# how to use Between operation in where clause
105+
# get all employees data who joined the company between hiring_date 2021-08-05 to 2021-08-11
106+
select * from employee where hiring_date between '2021-08-05' and '2021-08-11';
107+
108+
# get all employees data who are getting salary in the range of 10000 to 28000
109+
select * from employee where salary between 10000 and 28000;

0 commit comments

Comments
 (0)