Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
24 views
18 pages
DBMS Lab
Uploaded by
jin9696480052
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save DBMS lab For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
24 views
18 pages
DBMS Lab
Uploaded by
jin9696480052
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save DBMS lab For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save DBMS lab For Later
You are on page 1
/ 18
Search
Fullscreen
Sut b> eR Atagoiam jov Univercity DababoreRew i s- DDL :— Data Dejisition Language ques ang manage She sheuctene ay @ dalabare xCeeake a sable t ey, CREATE TABLE customers (eustemer-!d map erinnry KEY Civst— name VARCHAR (50), dask — name VARCHAR C60)» emoil VARCHAR (109); to manipulate DML s— pata maripalation Hngeege queries one — dota within a data bare - “Tnsecr data to 9 Jobe: NSERT INTO customers (customen- id » Pivst—rame, Ncst-name, email) vauues (4, soho", ‘Doe's ‘oho _doe@ example-con D5 ie Upaais dala 19 dette + - UPDATE Customer SET emedl = ( johndoe @ WHERE custome: — td = xDelete dala jsom a dables = FROM customers cetomen —Td DELETE wHEREFRom own JOIN peordicihated ON. owns, dedven Td = panlt pated. delven—id. Ton accidenh ON pantieipaded « gepsrt—ovmben = accident. otebort — number. WHERE YEAR Caccident. date) = 1989; BH SELECT COUNT (*) As dotal—acctderba FROM ponticipaled Ton pewon ON panticibated . dsiiven—ld = peson-dvtven-id Ton can ON paxteipated.ear = can: license WHERE pedon. name = ‘John Smiths Ars B A> SELECT employes —name FROM usorks WHERE company ~ncrne = Firck Bank Corporation's b> SELECT employee. employee —name , employee -city ROM employee Jos works ON embloyee. employees ~nomes works em ~ ployee -name where corks. campany = name =" Pivat Bonk eonorrabion so> sevecr company -name FRom works GROuP BY company - name HAVING <€tunk fem COUNT Cemployee emp - cound) FRom Csececr count (employee - PRom works GRoup BY campany =name DAs Counts 3 b>. seLecT e-employee - nome _pamed= (SELET ax name) o> emp- count PRom employee & Torn work w ON e-emptoyee —name = C0" employee Name were w- selarg > C select Avg (salary) FROM works WHERE company ~ name= vorcompany-feme % o>. SeLect employee —name Rom employee WHERE employee “name nor ry (serecr emplayee-rame FROM works WHERE comprny~ neime= fest Bank corporabin’ %morte FRon Employee @ TOM — manages m ON e-employee —-name = Mm- emir Name: Ton employee mang ON m- manager—rame = mong. p ryee- name. WHERE e-city = rong. cily AND e-ctvek = rong streets ‘SEL CONCHY (4 hename, dant rare‘) At Mle nme COUNTS Ay Cabal oeden, 80M (orden Carnot’) Ag olal —arnount , | NG Condon anaunt) Ae aventige ae | Min Cardine data) AG Chad. odin ee May (onder. dale) ag Sart _ odin date, PROM odens WHERE cwlomen td = 12345 GROUP BY CullnamesAas too t- SELECT e- employee =name Ans a>: FROM employee © eect * w WHERE Not €xists (s FRom works WHERE Ww: Company names Small Bank Corporation AND w-salany > = evsalony) Ans _b>s- SELECT company ~name PRom works GROUP BY Comoany-rame HAVING SUM (salary) =( sevecr mim Cbotal ~Solary) FROM (SELECT Sum (Salony)oy, otal - salary Fram works GRouP By Compary—nam ds ) Arec 3— SELECT <. company -name = FROM company © Torn ks works WON © Company name, sw Company ME. GROUP BY c+ Company — Name HAVING AVG Cus-solany > (SELECT Avg Csatany) PROM usovles WHERE company—name = “Chast Bank corporation 5)% a& Powgeclon Crr)s SELECT employee -name » stuvet. city PRON employee; a Seledion Co: SELECT *& FRom employee WHERE city = ‘Neu York’ Dd Castestan Paroduck (x): SELECT e. Employee —name , Ce Company ~Aame Rom Employes € , Eompany Cy GS Union (ud: Se€vecr Embloyee - name , shreet » city, FROM employee UNION SELECT employee - name sshreet , city FROM works; WY Set Diference (-); Sevect employee =Name ,chreet rothy Fron employee EXCEPT SELECT employee name , strech, city FROM workes by. SELECT e-employee -name , vo. Company — name FROM embloyee € TON works w on €-€mployee— name = ww: employ ce -name; e' . QS. seLect A Prom oy eB setect © FROM WHERE B E193 >> streer * FROM oss a>. sevecr A,e FRom (secect * FROM oS where c=ddAS anesalt Ans B3- ay. Sevect * b>. SELECT © FROM ah ERom et UNION sevecr * TNTERSECT PROM 12; Select * FRom M25 cd). setecT * dy. sevect ot. , v4.85 Rom sd Sa Bo, HAC except CROM ott ,9t2 3 sevec* ( FROM 3124 etAmd4s. sevect Piorkname Lawl —names Agctem CoELECY Guat (A) BRON orden WHERE Eantonen t= — REtommen . cugtomest= lel) As tal oedons Customers 5, AML Ad — SELECT com my dame From company WHERE ctty tn (seLecr Dis TINCT ily Rom company WHERE — Company -| ) rame= ‘small Bank corparealion' Aesb> uppare works SeT salary = salany* 44 'Pivak Bank Corporation’ WHERE company —name ein (sececr empleyee-nome fROM manages WHERE manager Mare in ( SELECT employed - AME AND employee —ramn FROM works WHERE Company name = “Pixst Gank Covpovilion’) UPDATE works ABE cer Salany = CASE DIMEN Sevloony © {4 £=100000 THEN Salary | tL * {03 €Lse salary END F WHERE company —name Pies Bank comoralion And employee name IN (SELECT enbloyce— Pg bce PROM manges WHERE manager— name IN ( asf K SELEGT employee -name PROM works WHERE company - Name = Rieck Genk - poration’)Prat lo Any A:— DECLARE ‘Fnpub- Shodng VARCHAR 2 (10d; Mevernsed ~ stating VARCHAR 2 (aod; BEGIN inp — shoigg + = Cyoun —shsdag - here's srevensed — stving t= Revease Clopuk -shenieg)} TP Tapub- Shatteg 4 = reversed —shsring THEN , DBMS — OUTPUT. PUT-LINE ("he given stxigg T% a paticelvone!) Ese DENs—OUTPUT. PUT—LINE (The given string In nota palindrome!) end IF; END; Dns Bt- DECLARE : 7 Ni NUMBER + = 03 J n2 NUMBER: = 43 next— number NUMBERS Med NUMBER t= 103 —— Change dhe jimit ax per youn steguive ment BEGIN DBMC_OUTPOT. PUT (m1 I" ' {| na | ' ys FoR © IW 3.6 Limit Loop next oumben .= NL +n23 DOMS- OUTPUT. PUT Cneet— number ll’ "Ss Nis =n23 N22 5 next—numbers END LooP; DBMS — OUTPUT -NEW-LINE 5 END;DEcARE Tnpul— nonber Numer : = 12345 5 --change ‘Tnat number ay per your srequise mend + Sum ah digits NUMBER + =05 Yemp.~oumber NUMBER : = Tinpul—numben; Bequy WHILE demb-nomber > 0 Loop i - PUA Sum_al ~ digits = sum ~af - digits + Mob Gen or dem) —oumben : = Ploor Ger -numben /1o); END Laoes DENS —OUTPUT «PUT LINE (Te Summ q) Aigita af [| input nanbor Wl 76" 411 sum ~f ~ digits); END;i MeL Rowvances— st ON DAHS , ReLLAACK ta a command hat ollews yo uy = changes made Yn JSransaction. pit helps you sevesch dhe dotabare bac! Slate before the dvansaclton tet exectded: bo unda 1 to Ho preview * COMMIT y SCOMMIT In a command hak Saves the Changes rade Ine Sransackion. parmanently- DOnce You tssua She CommiT command, the changes beems panmanent and Canret be solthad Qalled back * CHECKPOINTS ¢— Mere ase masikexs or seyerence points in She dvansaction doy af a database They axe wed do Indicate a consistent slate 4} the databue ab a certain poink Tn dime. dCheckpoints hedb un crecoverty cand siestoring dhe databare do a consistent state In Case of system feulurey ov crashes. Ars A$— INSERT WTO accident Corehort- number, date location) VALUES (4, "2028-12-13", © City x"); ROLLBACK; Am Bp— UPDATE cor SET mode = 'New Model’ WHERE thcenge =' ABc 123’5 % TONMIT ;CREATE FUNCTION coleulabe — aed (oadlas fo) REFuRNS PLOAT DECLARE area FLOATS ‘ ae aimigg * wadius & radius RETURN axea; {os a:— Req END; Ans 8:- eB? ~agent Creare Procedure insert customer — ard ~49e ( TN customer id CHAR (wd, IN IN TN TN IN In tN ) customer —name VARCHAR a3), customer — city VARCHAR (20), Customer — discount REAL, agent -id char 3), agent —rame yarenar 3), agent ~ city VARCHNR (2), agent’ — pevent NumBER (6). BEGIN INSERT INTO customes (cid came, city, ditent) VALUES (customer tds cu Tnse RT INTO agents (aid , ciname » oj VAWES Cagend— td im END; ; some name y customer acity, Custoren — discount); agen Wys pencend’) regent nq . agent —pecenty, WS, 5 CaAnsi:— a> DECLARE emp-name VARCHAR (50); emp ~de host memb VAR CHAR C505 Emp — salary NUMBER (10,295 stotal — satay MumeerR (10,2)$ CURSOR employee — cunsoy 1S SELECT esname, e-departmend , ¢ salary FRoM employees e ORDER BY e. department; BEGIN OPEN employee — cunsoe; FETCH employee — Curse INTO emp~Name, emp mica ~dment 1 emp ~ Salary ; WHER WHILE employee ~ Custsoe % POUND Loop TF empadepadmend | = emp — defarttmend TREN DBM — OUTPUT. PUT —LINE (' Total salany gov Deporrt- = ment ' |] emp—defartment |]5° I] dotal— salary); emp—depardt ment += emp-de partment 5 dotal — sales nO eND TF3 dotal — salary 1 = dlal ~saloory + emp ~Salary ; FETCH employee —curso INTO emb—Name, emdehart -ment , emp ~ salony ; : END Loop; DBMS— ouTPUT. PUT LINE (“Total Salary for Depantment'femp ~ department IPs VW dolet salony; < emb_ department t= emp. department; Solal — salary <9; | End Ths | dolal — Saloay s = dofal satay + eny aleoey | FETCH employes - Corse INTa emp— names emp ~ depant- =ment , emp ~sclany END LOOP; parlment Dams —ovrpur.PuT-Line ('Tokal salery for De ML emp~ department We [p dalal - solong); CLOSE Employee - ctorsore; ENDS by DectAare eEmp- name VARCHAR (50); emp — {eb VARCHAR C5095 CURSOR employee. ~ CwrSO¥ Is SELECT e-name , e+ job FROM employees & WHERE e-fob IN (Manager? £ Analyst") ORDER BY e-name; FETEH employee — ctor INTO emb-name , emp — jobs 2ND Loop; | BEGIN OPEN employee - CUrsovs FETCH employee — Cursor INTo emp name, emp-job} WHILE employee —cersov 7 cond Loop Temp -name ll 1, Tob: ‘|| emp—Job)s | | | | clos . exe employee ~ cursor 5©). CREATE OR REPLACE TeIqger chece— deptng ~dsigges RERORE INSERT OR UPDATE oN DEPT PoR 2AcH ow BEGIN TR : NEW-DEPTNo IS NULL oR (SELECT count C#) FROM DEPT WHERE DEPTNO= S NEW. DEPTNG)>0 THEN RAISE — APPLICATIO C- 20001 , * Duplicate
You might also like
SQL Handbook
PDF
No ratings yet
SQL Handbook
127 pages
Details About DDM Lab
PDF
100% (1)
Details About DDM Lab
33 pages
DBMS - Practical List - 1-4
PDF
No ratings yet
DBMS - Practical List - 1-4
8 pages
Dbms Lab
PDF
No ratings yet
Dbms Lab
52 pages
DBMS Assignment 1
PDF
No ratings yet
DBMS Assignment 1
14 pages
Idassignment 3
PDF
No ratings yet
Idassignment 3
11 pages
MDBMS Assignment 1
PDF
No ratings yet
MDBMS Assignment 1
10 pages
Emp Database
PDF
No ratings yet
Emp Database
8 pages
Company DB
PDF
No ratings yet
Company DB
12 pages
Handwritten Queries
PDF
No ratings yet
Handwritten Queries
6 pages
DBMS Exp 8
PDF
No ratings yet
DBMS Exp 8
5 pages
SQL
PDF
No ratings yet
SQL
16 pages
DBMS Unit2-1
PDF
No ratings yet
DBMS Unit2-1
27 pages
Cs SQL Program 3 and 4
PDF
No ratings yet
Cs SQL Program 3 and 4
12 pages
RDBMS LAB (II B.SC CS)
PDF
No ratings yet
RDBMS LAB (II B.SC CS)
43 pages
Adobe Scan 20 Feb 2025
PDF
No ratings yet
Adobe Scan 20 Feb 2025
20 pages
DBMS Record
PDF
No ratings yet
DBMS Record
37 pages
DBMS Exp4-1
PDF
No ratings yet
DBMS Exp4-1
4 pages
DBMS File
PDF
No ratings yet
DBMS File
24 pages
SQL Ip
PDF
No ratings yet
SQL Ip
15 pages
DBMS Cia - 2 Questions and Answers
PDF
No ratings yet
DBMS Cia - 2 Questions and Answers
24 pages
Dbms File
PDF
No ratings yet
Dbms File
13 pages
SQL Notes
PDF
No ratings yet
SQL Notes
22 pages
Dbms Assignment 2
PDF
No ratings yet
Dbms Assignment 2
20 pages
Adobe Scan 01 Sep 2023
PDF
No ratings yet
Adobe Scan 01 Sep 2023
15 pages
DBMS 1st Yr 2nd Sem
PDF
No ratings yet
DBMS 1st Yr 2nd Sem
51 pages
Dbms
PDF
No ratings yet
Dbms
11 pages
DocScanner 21-Dec-2024 1-07 PM
PDF
No ratings yet
DocScanner 21-Dec-2024 1-07 PM
40 pages
Dbms 1
PDF
No ratings yet
Dbms 1
24 pages
SQL PDF
PDF
No ratings yet
SQL PDF
36 pages
DBMS Mod2
PDF
No ratings yet
DBMS Mod2
11 pages
SQL Notes PDF
PDF
75% (8)
SQL Notes PDF
170 pages
SQL Notes2
PDF
No ratings yet
SQL Notes2
30 pages
DBMS (Lab)
PDF
No ratings yet
DBMS (Lab)
16 pages
SQL Notes
PDF
No ratings yet
SQL Notes
79 pages
SQL Server
PDF
No ratings yet
SQL Server
91 pages
Dbms Record
PDF
No ratings yet
Dbms Record
49 pages
SQL
PDF
No ratings yet
SQL
17 pages
DBMS Record PGM 5
PDF
No ratings yet
DBMS Record PGM 5
14 pages
DBMS Lab Experiments
PDF
No ratings yet
DBMS Lab Experiments
31 pages
DBMS
PDF
No ratings yet
DBMS
21 pages
Practical 5
PDF
No ratings yet
Practical 5
6 pages
DDLDML
PDF
No ratings yet
DDLDML
9 pages
DBMS Unit 1,2
PDF
No ratings yet
DBMS Unit 1,2
21 pages
DBMS 3rd Assignment Upto Question 6
PDF
No ratings yet
DBMS 3rd Assignment Upto Question 6
13 pages
SQL Notes
PDF
No ratings yet
SQL Notes
25 pages
Dbms Notes
PDF
No ratings yet
Dbms Notes
24 pages
DBMS Lab Experiments
PDF
No ratings yet
DBMS Lab Experiments
6 pages
SQL Notes
PDF
No ratings yet
SQL Notes
14 pages
DocScanner Oct 29, 2023 5-45 PM
PDF
No ratings yet
DocScanner Oct 29, 2023 5-45 PM
9 pages
SQL Exp 1
PDF
No ratings yet
SQL Exp 1
15 pages
Gudlavalleru Engineering College Gudlavalleru Department of Computer Science and Engineering DBMS Lab Manual For Students II B.Tech II Sem R-10
PDF
No ratings yet
Gudlavalleru Engineering College Gudlavalleru Department of Computer Science and Engineering DBMS Lab Manual For Students II B.Tech II Sem R-10
48 pages
DBMS 2
PDF
No ratings yet
DBMS 2
18 pages
MOD3 IMPqn+ans
PDF
No ratings yet
MOD3 IMPqn+ans
6 pages
Database Management System
PDF
No ratings yet
Database Management System
56 pages
Lab Answers
PDF
No ratings yet
Lab Answers
21 pages
SQL Programming Lab - Exercises
PDF
No ratings yet
SQL Programming Lab - Exercises
8 pages