0% found this document useful (0 votes)
41 views

SQL Script

The document creates a Test database and uses it. It then creates an employee table with fields for empid, empname, designation, salary, and hiredate. It inserts 10 records into the employee table with details for employees. It then performs various SELECT queries on the employee table to retrieve records based on different filter criteria on the fields.

Uploaded by

Developer 4
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

SQL Script

The document creates a Test database and uses it. It then creates an employee table with fields for empid, empname, designation, salary, and hiredate. It inserts 10 records into the employee table with details for employees. It then performs various SELECT queries on the employee table to retrieve records based on different filter criteria on the fields.

Uploaded by

Developer 4
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

create database Test

Use Test

create table employee(empid int, empname varchar(max), designation varchar(100),


salary money,hiredate date)

insert into employee values(1,'Naresh','Developer',30000,'2020-01-23')


insert into employee values(2,'Naveen','Manager',100000,'2017-09-12')
insert into employee values(3,'Sudheer','Director',200000,'2017-01-01')
insert into employee values(4,'Roshan','Sr Recruiter',55000,'2020-01-10')
insert into employee values(5,'Dev','Recruiter',36000,'2021-01-23')
insert into employee values(6,'Akilesh','Recruiter',15200,'2022-04-14')
insert into employee values(7,'laxmikanth','Bench Sales Manager',90000,'2022-07-
28')
insert into employee values(8,'Manikanta','Bench Sales Recruiter',25000,'2021-10-
18')
insert into employee values(9,'Pratheeka','HR',100000,'2017-01-01')
insert into employee values(10,'Prashanth','Tester',40000,'2019-05-18')

select * from employee

Select * from employee where empid=1 AND salary=30000


Select * from employee where empid=1 or empid=2 or empid=3
Select * from employee where designation='Developer' or designation='HR' or
designation='Tester'
Select * from employee where empid in (1,2,3,4)
Select * from employee where empname in ('Sudheer','Akilesh','Naveen','Roshan')
Select * from employee where empid not in (1,2,3,4)
Select * from employee where designation not in ('Developer','Manager','Director')

Select * from employee where designation='Recruiter' AND salary>20000


Select * from employee where salary>30000 AND salary<100000

Select * from employee where hiredate>'2021-01-01' AND hiredate<'2021-12-31'

Select * from employee where salary between 15000 AND 50000

Select * from employee where hiredate not between '2020-01-01' AND '2022-12-31'

Select * from employee where empname like 'p%'


Select * from employee where empname like '%h'

Select * from employee where empname like '%a%'


Select * from employee where empname like '___e%'
Select * from employee where empname like '%a___'

Select * from employee where empname like '%r' OR empname like '%n'
Select * from employee where empname like '[NSRD]%'

You might also like