0% found this document useful (0 votes)
20 views4 pages

10 SQL Commmands - Worksheet Iii

sql worksheets

Uploaded by

amansirdav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

10 SQL Commmands - Worksheet Iii

sql worksheets

Uploaded by

amansirdav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DEWAN PUBLIC SCHOOL, MEERUT CANTT

INFORMATION TECHNOLOGY (402)


CLASS X
UNIT 3: DBMS
SQL COMMANDS - WORKSHEET III

1. Consider the following table named Employee and answer the questions that follow:
TABLE: Employee

a) Write command to create the table Employee.

create table Employee (ID integer primary key, NAME varchar(30), AGE integer, JOB
varchar(20), CITY varchar(20), SALARY integer, PHONE varchar(20));

b) Write command to insert a new record in Employee table with the following details.
ID : 6 , NAME : Shivam Sahai , AGE : 42 , JOB : Salesman , CITY : Greater Noida , SALARY : 40000 ,
PHONE : 7889788909

insert into Employee values(6,’Shivam Sahai’, 42, ‘Salesman’, ‘Greater Noida’,


40000, ‘7889788909’);

c) Write command to display all records stored in Employee table.

select * from Employee;

pg. 1 MEENA DOGRA


DEWAN PUBLIC SCHOOL, MEERUT CANTT

d) Write command to display the details of Employee having ID 2.

select * from Employee where ID=2;

e) Write command to display the details of all the Clerks stored in Employee table.

select * from Employee where JOB=’Clerk’;

f) Write command to display the id, name, city and phone number of the Manager.

select ID, NAME, CITY, PHONE from Employee where JOB=’Manager’;

g) Write command to display the names of all employees whose age is above 30 years.

select NAME from Employee where AGE>30;

h) Write command to display the details of employees in descending order of salary.

select * from Employee order by SALARY desc;

i) Write command to display the details of employees in ascending order of job.

select * from Employee order by JOB asc;


OR
select * from Employee order by JOB;

j) Write command to display the job and age of employee whose name is Priyansh Goel .

select JOB, AGE from Employee where NAME=’Priyansh Goel’;

k) Write command to display the names and annual salaries of all employees.

select NAME, SALARY*12 from Employee;


OR

pg. 2 MEENA DOGRA


DEWAN PUBLIC SCHOOL, MEERUT CANTT

select NAME, SALARY*12 “Annual Salary” from Employee;


OR
select NAME, SALARY*12 as “Annual Salary” from Employee;

l) Write command to display the names and half of their respective monthly salaries for all
employees.

select NAME, SALARY/2 from Employee;

m) Write command to increase the salary of all employees by 1000.

update Employee set SALARY=SALARY+1000;

n) Write command to increase the salary of all Clerks by 1000.

update Employee set SALARY=SALARY+1000 where JOB=’Clerk’;

o) Write command to delete the record of employee having empid 1.

delete from Employee where ID=1;

p) Write command to delete all records stored in Employee table.

delete from Employee;

q) Write command to display the details of all employees whose age is between 25 and 30 (both
values included).

select * from Employee where AGE>=25 and AGE<=30;


OR
select * from Employee where AGE between 25 and 30;

r) Write command to display the details of all employees who are either Clerks or Manager.

select * from Employee where JOB=’Clerk’ or JOB=’Manager’;

pg. 3 MEENA DOGRA


DEWAN PUBLIC SCHOOL, MEERUT CANTT

s) Write command to display the details of all employees but for Clerks.

select * from Employee where JOB<>’Clerk’;


OR
select * from Employee where not JOB=’Clerk’;

t) Write command to display the name and job of all employees who earn more than 80000.

select NAME, JOB from Employee where SALARY>80000;

u) Write command to display the details of all employees who earn between 60000 and 80000
(both values included).

select * from Employee where SALARY>=60000 and SALARY<=80000;


OR
select * from Employee where SALARY between 60000 and 80000;

HAPPY LEARNING DEAR CHILDREN


COMPUTER SCIENCE
LOVE AND BLESSINGS
MEENA MA’AM
MEENA DOGRA

pg. 4 MEENA DOGRA

You might also like