0% found this document useful (0 votes)
4 views8 pages

Dbms Assignment

The document contains a series of SQL queries and commands related to managing an employee database. It includes instructions for creating tables, modifying columns, inserting, updating, and deleting records, as well as retrieving data using various SQL SELECT statements. The queries also cover data manipulation techniques such as filtering, sorting, and grouping results based on specific criteria.

Uploaded by

samwadtamboli1
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)
4 views8 pages

Dbms Assignment

The document contains a series of SQL queries and commands related to managing an employee database. It includes instructions for creating tables, modifying columns, inserting, updating, and deleting records, as well as retrieving data using various SQL SELECT statements. The queries also cover data manipulation techniques such as filtering, sorting, and grouping results based on specific criteria.

Uploaded by

samwadtamboli1
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/ 8

Shebo esca Enah Simon

T 24 65

Assianrnent

Defining Data
Q. Wnt an saL Query to tHtat employee
table with wlumns,
EM2D, debaxtment, saary Joindatand manar ID.
Create. table enmglayee
Empid ini primary key,
Emp n0mE yarchar (50),
Departént varchar (50),
Sary deimal (102),
|oin date Dare,
managerTD int.

2.0rite an SQL aUery to_add a new


column Email to the
emplouee iable.

A2. ALER Table emplouee add (email varthar (iD0));


Q2 rie an saL auers to modifs
the ata type ol the salars
olumn in the em
ployec +able
A3 ALTER Table employee modts (dalary num ber (i0))i.
Q.4. 'rik query t droþ the
manager TD olumn from émploec
A4. ELTtR Table embiyee DROP calumnmanaqer Td,
Q5. wik as to semoe al ecord trom the emþeyee
table wittout dletin tte Shuctue

A5. TUNCA Te 4able


employee
Q6. Wrik quey to name emnþloyee table to ay
AG.. ALTER Tabe employee sename o atas h

Manipulating Data
Q7. l0rik que to insert new employee ieord into employeL
table

A9. InSert into employee value a, Sheba Jica | T .


70000 , (2025 - O1- g3, yquy-mn -dd' , 106);

Q8.0riR query update salary of employ ee with ¬mptd 101.

AS. UPDATÉ emioyes SET Salary :60 O00 . 00 vohere EMPId 01.
Q9. Wrik qpery to delete employee rom the. employee table where
Ernpld ro9

A9. DELE1E fhom employee where Empld |05.

o. wrik qvery to aelieve all

A1O Selet * rom employee;


Cantral

Retreieve Dala using the SQL SELECT Staernent


Qn. Wrik an saL query to seleu all wlums froIy the Em þloyee
tabu

A11. Selet * from Employee ,

Q12l orite an SQL query to selech only Empld, tmpName and


Salary fom the Embloyee table
AJ2, Select tmp+d , émpname, alary thom emþ loyee j
Q134 Üaik query do disblaysalary at each empioyee at kr
nladdin g a 10°o inMement

A138elect EmName salary, Daary *]J e


om þloyee j Aary om

14 Wsit an SQL query fo dis play the shuctue of the Em þloyee

A14 fo display n e shucte ,I wir use DESC


employee
G+s. ttihe quey t0Vsinq. WHERE clause & Sorting atbut:
OIS rik an SQl query fo liere emboyees who work in the
I7 da þartment
A1s. Select Pepaa hmentr;
R Wrik an sQl query do nehiexe employe es who Aadery
qatn than 50,000.

Até" Selet * {nom employe hot Sal ars 0,000

Qi7. ONie queny do diteeat display employo es sor kd by


EmhNarno in ascndin g rd
A17. Select * trom embloyee ORDER b EmpNam ASC,.

QI8.. orik an SQL query to dis þlay employees sorkd by


Salary in descanding order
AM6. Seled *

M9 iriK an SQL quey au an Embloyee table


with the Emid coknn au NOT NucL

A19. Guatt able emþloyee (


Empld NOT NLUL
Emp Name Varth au (10D)
Debartment vanchax (30),
Saaay Decimal (10, 2),
Join datu DATEJ
Manageu îd INY
);
Q20. Wsite an SQl qvey do enswe the tmail columa üs he

Gmpoyea 4abe hau uNIQUE Vaes


A20. AUTER Tabe Unpoyee ADD (AN6(RA UN YS unique email UN(Q)
Cemail);
Q2. Write an SQL query to dtine Empid oy the Primany Key
A21. ALTER Table Employee ADD onshaint pk emp primary
key (tmpld);
22, Write an SQL Query deine Manag er Id as a EOREIaN KEY
Mefun inq Emþid in tho Same tabu

A22ALTER Taole amplo yee ADD Conshaint pk manaqer foraign


Key CmanagerId ) Reiens Gmployee (Empld);
Usin SQL operators Clauues:

Q23. 0 rik
an s0 quéry to DËsHnt.
dispay uniq ue to b zolee from the
Gmþoyee tabu bsing
A23Select pisTINCT Depasttment fuom Cmployee ;
Q24 Woite an SQL qvery to find emþloye es whobe
salacy is in
the ra e o40,000 to g0,o00 wing 8¬TOE EN

A4Select * fuom employee whene Salary bltwn 4000D AND 80,6 DO ;


Q2s. Wie an SQl query to fin d empioyees uo kìn q- in either
"HR' Gr "Finanu' wing iN.
A25Selet faom Emþlos ee OHERE Deputment IN ('HR', INANCE);
Q2b. Wite an SQL. query to ind employees whose n arnes Start
wlth A in uKE

A26 Selet* fuom emoyee. uOH ERE Emp Nume uKE AZ.;.
Q3. Wxik an sQL query vsing DR to find employees eitheu
|n
maskimg' or eaHningabove 70, D00

A28. Sele ct t 4uom &mployee uhee Depautment MauKAhinq


OR Salay Y 0,000i

Q27, 0Lie an SQl query to fnd embloyee who bave a NVLL


value in the man aqerId Z¢

A29. Select * faom mployee ohere managerld ü Nuu;


Q23. vÖrie an 8QL queny to qu0up empoye by depautment C
display the number at emp koye in each dehantment

Ae9.Selet debautm ent , coun t (Y) Ao emp oyee count fom

Q30. 0site an sQL Query o ke depauments that have


mere than 5
employe ea uing having
A30 elect depautneut, count (*) As embloyee couni fom embloyee
gRDUP By Deþautrment HANING count (*) y5;

laspanunsat (asunóin4) then by salany (duan ing :


ditenu; ay ol0,000)
As (90,000
-1s A36.SE61
APS
dittena. 0lhy qiven
absoue the tHnd quey
to 301 on WiQ36.
rMe
Pood dqvoau (salany
) (M0x SORT Selue A37%
Salary higheai
he of
so0t sequAne the ind toqueny gol anWe Q.
amploy
e; rom oy
emblee lal to AM
) (ounl( A35elet
employee
ben num tutal the wunl tuqueNy SOL anwik Q35.
emloyca; fom `ulary aay)
tolad (Baldo SuM SELELT A34.
mployes. al
pad ahy Aotal thcalua o
qusny sQan Oxik Q34
xalanu M4
(Aalany) MAXMinsalaay, as(salaMy) Min Seled A33
jany Lom
1he un yla Aa max in heliod queNy
u S0L anWle Q3,
eantloyee; aom Aalauy Avuage (Salng)
As nvg Selel A82,
emhloyeea
tho tnd queM4
to S01 anWlk Q32
funtwn Mathematu
cat uqute gg
AAS SeleCT mpld , Emp name, Round (salany ,a) &a Roun ded
dalany hom tmloyee ;
Q39Wile an sQl quwny to hunalu ehnh loyee Sat ais tu
2 decimal plaeo

A34, Selet Empld, emþM me TeUNCATE {s aley 2) b unalel


Aany fom bn playee
R40 WiH an SQ Quey to tindhe emain do when emhlayegs
is davided by SOO00.
sateny
Se'ec Gm+d emp Name , Jadary dalaay s0,s0 M
Remaind om emayee s

You might also like