The document outlines various SQL commands for creating and managing a database, including creating tables for books, members, authors, and companies. It also includes examples of inserting data, selecting records, and performing queries to analyze the data within the database. Additionally, it discusses programming logic for calculating values and managing user inputs.
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
0 ratings0% found this document useful (0 votes)
7 views49 pages
Dbms Record
The document outlines various SQL commands for creating and managing a database, including creating tables for books, members, authors, and companies. It also includes examples of inserting data, selecting records, and performing queries to analyze the data within the database. Additionally, it discusses programming logic for calculating values and managing user inputs.
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
You are on page 1/ 49
; a Nh
[fu _@ lode tetuins in a database . The database
lean be loaded _With hooks _infoima-hon +the
student can 4 ity th hi
| egisdes e ihasy to
‘Lhe kK a e
aeeobes with a valid rer A
| " 4[QUE RTES _
| Book
[CREATE TABME BOO CRook 1D In Nor no open
Nowthas Cur) ,B00\. _ Atame Athos Voschaa Cus), _|
D b\ishey — 1 NT Nor Nt PRICE
rer i,
\NSERT. LUE. “ uN 1
NI 1 E 3ao,\BA" Ca’ way
ar 7
LNSERT nto Books VALUES C30,"Ca" ‘Dat 513) .)
4
SEAECT_” FROM Boos
al MemBeR -
LCREATE Tage MerseER (Me 1D JT Mor Web Me Name
-Emoil Va: =m Ty
LM. no INT Not nuit).3|_ BLTHoR ___
le pes
Pene:
teeters
(MeEeT TWD AvtHOR age —— DELL, |
| fr ae an
JE
| cect x FROM
MEMBER
Mor Nuh primay |
=
[PUBRASHER
SEARCT ¥% FROM
AUTHOR;
Icrtons Thos ouAtsHke C Pip Int NOT NY
‘a Name yaoichay a,
as
P_ kmoil vowchay Cvs), Pao
XYlyefeieore ¢ Coy _Mame 9)-
Ne ee ee Tal ae aad ey,
aera Aobk-KsbizC3- 10-4, COEF, eo oe ee ante Goosen HE
aecr % FROM. Book- LUE
6 || Book RETUR WY
\CREATE TABLE fook RETURN Gs tue dete ote
#7).
| ¥eduin ofate date WoT Nuih, FINE JWT WoT Wil, |
Lfielgn ley Cissve. date) sefewnper Booka tilwe Clstwen lak)7 = O8= -O8-a4,0);
“INSERT INTO BOOK — RETURN AI-O4~24, A 4-04=04,0);
SELECD 2 FROM. Godk SRE TUR; —
po
| MUET_1NTO TINE COMECTION C1, RAM, I1-0-d4, 4-ead , OF |
nsinT INTO Fie coum cron C.ay'Sann', 06 -H2Y 06-1940)
INIT INTO FIVE conecriOn £3, \Sowant, 25> 2-04 21-8, 84)
ns af r
\ SELECT * Ftom FINE COL CTO
|
— 4[ad tne the__bomes of all emplyyes |
pu be works far SBT
A in the doteabase ubo _|
| _five__sn the Same __cr'ty ed
|_fov which — they uoik -
[oP faa — aul the _ermph js
IE their datebase who ve jo fhe S@me!
cig ond SOnc. Shee+ pumbe as Hbeir
al Ina? AS
TE tf i
WEL QGe Onn|SFhecT * FROM _EMPAEE ;
Company Table.
ICieote, Yable
Company (Copp name. —vaichas Ar)
PRIMARY KEY Crp- Cu'k a
fe ae ac aHose eT
iota waks yohes2 ric ae Morgen mee
i four BY Em_p- Name | rmng~ name +_ 1
Salary > Co Select Avia Csolay) f Lorn _twotks
See cK Fugm wack, ae
\
|
|1 foruita Pandy code faculty name} | .
3. Studens [5b code ,»St name “Do” Biancr|
Ddmisdian a diwte.|
S =
‘Do the Follouiag guess.
| isplo th no of faculitie
‘splay the total mask fox cach suljecd
\ the subject , Average made fox __|
each Suby ecd |
Lo Os tke name of the subyecd Which
Oisploy —_ ubyec :
of mosk —_tubo_gat below 4o%/o
$ lish locat 5 ectlnseut indo. ao Ea (301 Saer_unt,
pa ints sub -au at Cont ots Cara ¢mP_ nw,
| e par ( a 2 \
[Inset inte ee Snaiee into value)
Cron), semet_Os 1 San r ‘0,104,
\ lu
Tons,
1 > ta) 1 :
_£. \ ‘mM wsy' i
ISkiecr + fiom OB. ay
| Sida
ICxea Ae table sick au ( St acte {ot
Pimay ke St_pame vaithay Cas) Dok
das Bunch Vachar Cas), Adein Me Oate) .
oeck tot iia vi Abhi ;
Insex+ io y i (oofpett—into sid as _Csf codes ; $+ name: i ob,
M biatch Adm. cate) values C002," ADMITS),
hep leony “as! os! act foro J;, a
Joe + itn __54d- old values C 004, | Ahoramed |
(fasseh', au 003) Arps! OF Jot foo)
|
[| —— - _ |
[put —nte sta “zHammed {almgr’
| / ot ‘lor J oct faa’)
/ -
(gfhECT #* FROM S#haduy |
Mocks 24. a oe _
I |
[eate table mats _au _(s4-tode int 1eleremes
Today Cid code J, {code lot seer err stb-o4
(Ch ode, J pooh. ind), — |
Terk LL =
ath au valte, C oor, 301 3a. _ 4
p lato
— __-\njo mage ay values Coo, 302,39)
“indo —_macdks-a4_ Values Cooi, 303,73)
—
— inte mail. 94 yolves
oo, 307,91)
(joto —maus—3y value (90,306 13)
lote _maiks-34 valves ea 304, 2%
ip masini Zaaay3a a]
emma 94 youes C003, 308, 3a _}.i aulss al a1
into agli ae values ( aie, 309,38
4
Cl
into _macks.au values ( nosso
into __matks- oh _oofied Pun rer
‘yrle mally ay valucsCO04 302, 3
ito Malig_ gu values (pn 720a/3a
inte mail. a valve Cony 202.32)
its math ay yaluu Coor,309, 34) |
into u-ay value —
atin Math. dy values ET 3)
seket + Tm Mailed 4 -
OU SEIECT Count (¥) fiom fac. au;
Lh specr Correct —— fiom sidan |
a6 stn Cesta As Tolan
fiom mals. 94 GRoup py _stecode,,ie SELECT Cs gieer +-name fiom Std 2u
E - i —_- Wo eo)
| fy Sduden+ a
orect C$ name fiom sub 94. S-codes
[Masks a4. S-code ) RS _Sunpect
1 Macks au. mahi Cmax mak *o4) Aa]
“Periemlage Slo! ___@RowP_BY__54 name “Smmae_-mnik,
IP emecy £ name As faculty eS
[—_s— name __Qs_— —Subjec, fiom —_—fac- ay}
Sub. ay Where Fac au f-code =
Sub. ay -f cod GROUP BYWHERE Sta. QU. Stcode = Ge ered te
| As __Studen}_, "|
| GRopPp__RyY — fname
above __Quess commands
| Count ( S.name) Aas Subjoct ,— : __|
| From Fac 94. code =
sub auef code |
Hanin 4 Count Gpame> 1i
{eax total |
6. find the company tha + pay
| alaty g twith th alas paid:
jhe fing ~ ibe Company that bas most emaploch |
| Ecchi F ighe : thon avesage | |
|__ Sala _of ‘ SBT —_
La find Abe name AL salaty ot oll conplayec | t
of SBr :
(CommmanasHawing Look \ —salasy > Cselect Saluy(a. find all voformadinn of 50r/o1 1 _tsbo have
yesewed hoa s Oumbes lol:
|b. Find the name of boat: yw seaved by Bob_|
|e. find the names of sailors _whn have seseived
Q ied boat and list in the idea of Qe}
a, fino the hames of soils hs have
1 WeServed atleast one haat.
e fina the id's _@nd__pamey _of _sailovas _|
Who ave _fereavech tuo different boats
on th SQme soy =
| £ find the 14's of salows ho have
xyese vec a
—— ind the nomes of sailors oho have __|
vesewea bmt 103.
Lh. find the names of saris whe hove ~fh
lawast age
i the ql \
|
j[sect * From.
| Boots Table
(seek tees
( + T sas i i
Ces ¢ Table Boats (bs id int ? ma ey,
ose t “Boots valves | loo , ‘May! Bea!)
into
act ints _Boaty value) (lor * Que: op Mateos!
Inte ras eeu eee eT
fe into Boat values 7 1 :
Toes + \nto Boat \ol
+ Fism —Bsati ;
select[psek Into _Rereive valued Coo Sa4- Tanna),
Jowett inte “Breve values Cy los, ta= Tan-29')},
Nhosest ity _ Reserve _Noluc
into Rerwive valucd
Inet inte Ronee $v Olue)
int iC {
jut —_iobe Porewe Values |
1 i ene NVOlue \
nut inte ‘Reve VV que
{nett io Rosewe Value y
ned Info Revewe valued
Het into Roewe vorluios C3, tos
la. Selec} _sasid ,S nome 5 toting ~S—age ——
Fim soils lp» s-icsewe suhes
Solas sid = ‘Tere si 4 AA = 10h
ih. Set T Boots. b.name OS Booinar: :
Eiom Baa t Salou Rercaves __ Whee7 ~ au!
|_ Sage fim sailors — Bets Messen
| — WHERE Gilour, seid = Reserve ad
Roots »baid = Berens b= id __ AN D
| _ CBoatt« b= color -‘Red! oR b.coles = ‘wuees);
[4 SEMECT — DistINct _S-name fiom Sailors
A@tew ey Whew Saito inc Sailost y!
e@ SELECT DIST vet ict, 5-name fiom sailo. t
ee ive. As L Qnck fe. eve. Q R2 MHERE~
| ailoy.s-id = Ri S-idt AND
| Goiloy. sid = fa . Sia ANIM) Bday. = Bday
| Ravn & Bid :
io ELECT S.name fiom soils: WHERE silos
Sin Cstiect ae Rerewes WHERE |
| Keseve =» Bia = 103),_
—COMM HALD
|_Saa 08 “Table
CREATE “InBUS__Std-06 CSid int Primay keys |
Ls name vaachos Cat) , Sage int). ___—__—__
— Save point
[inset into Stel ‘ Agusgre’ 1a), |
\ . @ _ iy & , ‘
pm — “pxart’ la)!
Jnxerh ints Std OSs ooSave paint
[Gpecr * FRom Sta og
Saxe point A
Roll Back
SELECT + FROM sid OR
| RoLLgAci To _fl_,
SFLECT ~~ FROM std oy,TICE aC ONVMIBNDS
lo. GRANT AMER _DATABA\E “Th _SVSTFM.
Lh. CoNNE cr SVSTEM
: & AULT’ TAB) ESPACE:
| ad REVOKE DROP ANY “TARLE FRolvi SYSTEM,
PES OLT-
oe fuecies ove _curmplede ef sucess tilly A
tsot sth te i
la ——
(CREATE TABLE _Sid-D Cs id int PRIMARY bEY ,
name Ga Chast Ca’ = age in):
\nsett inte _sta_ O8
| Cee ce fa std 08
{ ib
(ERE _INTOsta_ox Values (001 “Ameena ‘1s)|
Nose inte sda oe volver C G02 fms 8
| nik inte sda_Or value C003," Arjun
| value: ( oo4 , Akash” a |
Angst imp dd OR yoluar C oor “Tymat,
| fin, ints __stdo; values ‘
“3 ).et s ERVEROD > 2T ON:
Declare - a
Q@ humbes Cio)
bh pumbes Cio}
< Oumh ex 20 :Ne
~~ number (10);
AQ numbes C30);
BEGIN
| ys Res _
Qi 3.14 AvKy>
Lams cut put put line (Meo is Ia), |
Lang ff| 2 Stact
— Step |: sta
2". Enotes the 3 nmunmbesw
3: Find the Loacgest Dumbest
| — usi if... else. comddion
4: Pint Result
— so Find the _Serallest pum bea csi
1 if 1s elec:
= 6 peat desult_
_ step 1. Stop —_______
i - a a |
PADbRAM a ee
| aks Seaven output on, |
— Necloare a
— a number C10) |
i b number Cio)»
— c. Numbe Cao,
te Begin Oo
a as da; ______]
ee birdh; —________}
- = hc;
EE aoa Case)
—_ _._ then
QC “Aint mate pat lan teZD Ga)
ly Factorial oF a NumgeR
| peo an
. +
a: Eniey the pumbes
“A find the Facctoiel ning, sbiley
loop»
4 Rint the factoual> S4ou
| + Enites the _o4ginal pice
i iicount price
Hl 4: find dhe met Amoun}
a
Step 5! Sidop
=
I M.
r—
_ ST _SERVER OUTPUT ON
Dectarc
- Puce pumbe 4.= 0+
i dine pote constant numbe (= 9a
eo. nu 4
pd go nt urea |
} Begin
! Tpice += Apiite
_ p ;
| if Plice >= Sno,
L then |
40 tespet amount = pice,
end if;
Ir hms output pu line C Discount Amouails,
disc qmauod)|
f
om
c PT Net atanua)
—_ fod,
HE ZL _
a
(The above piogcamt ‘ample of Ute» ftly J
| feeeipes wal obtained
| _
JSt a ecient sean,
Create _a —_databare —tilgges Lligges to_calculate —
[nessa sa Sane aia he |
Baws THO el
———_— see |
fe Step 1 Sta a
}_ gt Cieate table “and ‘angen, Values
PL Cicate _a__Lrigge+ —
je 42 Calculote the Salary dikfesese|
a Display the salary arlference
{ —S4ep 6: Stop - /
Dearne a _
(PADOR AMA : _
CREATE — TABLE CULTOMERS @iD ink, , Dame —
|_vawhas CaS a age wr, address — iacho bit
lat INT); - - :
Caweer wr Cason ret ae 25000) _yy
|.
|
yin custome valuy (Jor, “curnars 40008)
SELECT %* From cust seas
I update on Curtome, for;
|
Qelete 0 loser oy
when Cnew . cid>o)
Dectas
Sal niff Numbes
Begin “ _ 7
L Sol diff = New. Salary ~~ old. Salaiy + |
| “dims output put tine Cold salary “tlold sald .
| _dims. output put lor CaNew salary =" I 2 ;
[ams out pub fil ine (“Solos Ditieremse: "||
- _ - Lat).
| End -
I 7 - - -
pe above —plogiam tt Lutcesshlfy evecutecd. 4
E tg — :ffo_ting Foctoval of o bumbes sing
fuaction
(BLbORITHM
Step 1° Sta
A! Reoct —jrput—valv
= inp 4+ _yalu «
Yim
Step 52 Stop _|_ BEGIN
i dbms. oud put pal hae 6 Ductal
|
i _ — -
fact Co),
‘od 5 .
i——_—— / |
EIUAT oe
i a oe
Bru bove pl. lsgh Plagramn success Fully exccyted |Teich te 1 | Name,
al
Exit chen co Not founa
Tob ‘= Total tSal,| Autlte a_i “sei piogtam to demostiate
DEaaRE
N-numbea ni ex C= 10
__N=numbes QQ numbey )- 5
Veaesult numbatib
err Ournbes
lapis — he
Z 42 Entes tus pumbeas a calling,
dep. 5% Stop
| |
| finok AA
TRE AaTE _O'R REDIACE PACKAGE _Mathaperc tics
las Peocenore Add Tuch z
| b Numba);
peat Subbiect Ts vo Number Ca Dunobest b
End aah i ppowbs ns
ome ok AEP —PatkaGE —A0de |bb ume
: BEGIN
ebb output 2 put—line C" 1
Hoct Tue Aferabew
| Lf4 Lion ond tool -for any
jpailem _ selected . The application —
-_ Shor bav .
bree N\anaae ment OY STEN
— -
“An cvent manage me ot stem
X core pte we pl webowen desi goed is
|focillate 4 « planning _;—¢ soudina bes and
jereco tien ot _cve ats
Te oS _Sewes as a __cents alizek teal
_ stieamline yousas aspects ot _|
___orgsoises tron naling the — _emtise—
c eae. efficie of _A_osganisec —
ao ynclud eS —_feattass for __planniog~—
(Quast, and atten dec eqi station ete —step 5+ Else
| pS te tg stintin tie
QURIN(@: LO @1N “TL NE
1 - Step | Usea _entey username at 1
_ Peas word
Qo: Click an spe button