Experiment:ugaa                                   Page No.
:    6
 Experiment No                       NMREC          Date.       bLL laa
  km t     Jo     cauatn   a   Compamy   empleyea   dooba
 iuigges
 Requuemunts: kat
 SOucecode
                   CReationm o dotabosm
Caeaie olotabase employee
                  Changng database
   Use epleyce
                                            ditads takle d
                 CaLatim oemployee
Caeole table employeo (name vaachou (u5), OCcupatAn
 VaichoM (35)        wekina - date        woiking - houas vaxchar ltd)),
                 Susestiug data ito table
Inseset ento employea values ' Rolbn'saendist'a030-10-ou n
 wolnes,' Engnee,'&080 -10-ou',1o)                    Ptor',Actor,'anao-10-o
13.'maito, 'Doctor, 'ad30-1D-Ou,Iu),'Brayden, Teache,
2020-10-ou, 1a) AntorDBusiness, 20a0-t0-ou, 1t);
                                                                  Page No.
                                                                  Date.
                                                  NMREC
            Experiment:
            Experiment No:
                                                                   Lweikin4
                                        wsckin4- dat
                          Ocupatie                                        12
                                                      1O- O4
                                           020    -
         Robin            Scientist
                                          2oR0-I0- O4
         wounOA
                          Engne                                           13
         Pelen            Actor           2o20- 10       -   04
        moncO
                          doctor          &O80- 10- 04
        Baydem           teacher         O9O-10-0+
    Antonio              busme            080-10- 04
    mntu                 PomnneA          2 0 8 0 - 10       eu
    Alenander            actv             D20-10- 0+
stud         std             Stud
                                       Subet          masks       Phene
    id           Coole      ome
                                                                  345u5693534
                                                      68
    1       O               Mark      ngluh
                                                                  98465u3565
             10             Toscph    phyats
3           03              Toh       maths                       q1653 269156
Experiment
                                                           Page No.        63
Experiment No
                                         NMREC             Date.-
                Before inmnt tigqo
  Deltmul
Cueclt
                Tigqo behote     -
                                     insest- empuwoking heu
 Behoie lWset on employe0 to eoth uow Peun                             v
wOakng- houis <0 then Spt                nou    wottiug- hous          o   E»d
 END
   Snsent data 'ntu tabli
                                                      '2020-10-03 9
inst to               empleyee values ('Noaku,'fomax,
                                                            Acto 2020-10-12 ,13)
insout          ito   employer   value       ('Alexomdun'
Select*om empleyee
   inut                  tiggen                                            (15),
                                                    int, stud-code voachar
Cauote table student-inho(
                           stud td
                                                                     Vanchan(30)
 Stuud- nome ovchan [30) deloault
                                       wvLL, Sukjcct
            ULL masks unt        pk ( stud.-icl    phene Vanchan lao)
                                                       ,
  dehault
  letault OLL)                                             3u5u563537 )-
                                               engish  68.       ,
i n e t into sudent.
                        umjo (1, 101,muk,
                                                   physics',0, 98 +6543565*
                            (     102, oseph',   '
i n s e t into student-unho
                                                               q4 663a6975
                            Valuus ( 3,103 ohn, maths', 40,
>inswnt into Student -no
             tom
                        sudleut-     inho;
Sele ct
DELIMITER /
                                                             Page No. :
                                                                            6
         Experiment
         Experiment No: -
                                             NMREC           Date.
                       stud           Subjct maks Phone                   lat o i d
    stdstud
              Code     hame
                                                       3136438            u:4l:3s
              Olexa nde Bioloqy                  6+
    id      nama              closs       Email-
           staphen                     stephen        jaatpoiunt Cem
            bob                        beb   janatpoúnt cem
3
          slaven                       Stevenjanatpoint Com
4         Alenomdas           S        Ale vondan@ javatpotut Com
   Experiment
                                                       Page No.:   6S
   Experiment No
                                             NMREC      Date.-
  >Cteode ggea atten_tnt- dstatlu atter inseot en studevt-inbo
  H each 20w beqn insent into studont-details Vaun
   new sud-id heuw siu-Code neuD. Stuol - name, mom Subie ct,
  neu     oiks.    nRU    pihene intime C));
  END
 inuut t o         student -info valuea       (1o, ttO.Alenamoa    'Bidoqy
  64 'U13u6u3g);
 Select     frem student-imto
 Beoce updecte tiggexe
 Coiean table          Sales inhoC d   INTauto.increment PLoduct Va cha
                                  IT   NOT MULL, tscal yeo9, Snuall ut
 Croo)    MoTNULL quality
 NOTOOLL)
                                      '2003 mauuthi Suzuki          ,   tl0,   A090),|
  set        iuto seles , inoNalues (
 015Avengen,120,            a0ao),"ao18 Honda shine', 150 a020),
0 I H Apache'      1   150 2080);
limito
                            Salesimfo bejote  update on
CLeate tigge9 beteae update
                                         -
                    o w 1 new quality
                                       > dlod.quality*
Sales-inbo Ho cach
ENDIF       END                               la5 ohne   1d:
update sales-imho
                   Set quoMty
                                              6oo   hee did a
                                                    uhee
updat   Sales.unho Set quantity:
                                       P a g e NO. .
Experiment:
Experiment No.               NMREC     Dato.
     id       Emp-nu   vald f
                                    OUmewnt
                                    55000 O
                 05    090-01 -1O
   Experiment
  Experiment No                                       Page No.       64
                                     NMREC            Date.
           Aapdali»q tiuen
      Coneal    toklo studenta cid wl
                                      auto   ineene nt        ,   nane
                                                                         Vochol30).
  cAos t
                  Gmalid
                       Vaonchon 60))
   instnt nto studanls
                       valuuos ('stephovn, b' stephen                uvalpetnt      pvo
   Alenanda,       1,
                        'alnandn jawatpounk Corn);
 delimetas
Caeo      tugge ate upclas- shudenta ofton update on studens
 01    eath abw begin inet into
                                studeutu Jpg vauos, END
                                                  -
 DEJIM IT1ER
>updot student            et clas   clas +)
 Belone dalute tigaen
                                                                           date
CAatu tohle Solaies(Emp-mumint valid Rreem
omeuund dec ( 3,2) dehault o):
i n e t into Salai (Ep-um Valid-Rem . ambuvt)
Voluus 103,' a0a0-O1-10,u5 000) (I03 a0a0 -01 -10'                       65000),
                                                                               Salaries
       thgge beloue dolit Salavúes bekote dlete
                                                                          on
Coneote
                          nto Salouy   tnd i
he eoth rouv loegin inert
Delinii
d t e daom Salaues             uwhA Emp-hum =103
Selert eom Solauos
totad.budget
45000. O
    Experiment.
                                                      Page No. t   1
Experiment No
                                          NMREC       Date.
    afltt delete thiggen
Ccate
 Geatec           table   SalasyEmp     um,   'l   ,Volid. eomdol
amotut) dec (8,a))
>     inseat      n t o S a l a y ( emp.mum , Valid   81om o m e n t ) y
values 10a,'20sO -10-10 us000)                 »( 103a020-61-10 66000o)
(105 a0RO-Ol -Io5500o)
     Coeate       toble   total - Salauy (Lolat budget dec (10.2) );
w e t uito total               Salauy     total. budot Select Sum (anwBtunt )
em Souloy
>Select* tem              total -Salamy
delete daom Soloy uBhere emup- no = 105
Selett * daom otal Salovm
      delet  em saloy wheReemp-                 no-105
       Select tum toyl 3alasy
Total-budget
 20 00 O0
       ent:CuAsass                                 Page No. : 4
Experiment No
                                         NMREC D
                                               ate eha
                           CURSORS
Cutes Cnso, in                 S9 u
Sysm memoy                                a
                                              tempeO        u
                                                                erecuto A SGL
                  set uohen      sqi staternens
                                            withua
                                 a
cuce A a               ok oiouws togetho                         pointe that
ideaeS a CuuRut opw t ua
netaieve
t a e dala om a
                          doitabase dbfe
                  vuult set one vuow at                                  a        me.
t          wehul whn      wewant to           manipulate
                                                the oecod Ga
toble uv a       Singleton mthod, in othan woad    Oni v0w at
a     tune l n    othex aoBads       a   C s o ean held moe than
on o u but com puocoss only one Aow at a time.h e
Set    o   OUos    the Cwise                                    actiwe
                                 holds is Called       th                Set
                Cuuors u
Jypes o                        sQL
        Iplicit cusea
       a      Eapit wuo
9mplicit Cuwu04- h s e types oCusos axe qenenatzd amd
wsed by tu        Syste dusng            th   anipulatuen a                  a   DML queny
IACERT UPDAT6 DELGTE) An npcut Cwws u also
qenenated by the Sleo whm a single e                               th selecked by
    a Selec     Comma md
                                                      Page
                                                              No. :   0
Experiment:
Experiment No:                           NMREC        Date.
   Selet         *hiom tutoials
                                               Date
                 Tle               uthor
                                              019-09-01
                Java               Kyishnoa
                                              Q01q-05-0
                 Jheechants        Sotih
          3                                   a019-05-o
                TovoSpnas          Amit
                                              0 1 03 -O1
                Andooi d           Ram
                Casandna                       01-0u-06
                               Pauthv
 Select
 7               *
                     om    bocup
       (D
                Tte            uthod           Dat
                 Jova              kaishna    &01-0 -o1
                Theechats      Sotish          Ot9-05-0
      3
                JOvaspomgs         Amut        O1-0S-Ot
               And roid            Pam         O      03-01
      5
              Castondzo            Puthy       O - 0 u - 06
Experiment:
Experiment No                                               Page No. : - 3
                                             NMREC           Date.-
    icit      Cunvo
                               1hi
WNA Uing                        p etuot oo Cwo
                                           Cuso                qenonafed y t h
                      aSelect Cemmand.m enplict Ccoo Contaims
aye     ta            ene o o , but eny            me a w      tan be puoencd
OimeAn enpit cuwa moves one oy ône ove th
SeCeKdy       n
                       eupcit cus%           uMs     a   hoindus that heldk th
tghd o t a st6. G e t e h i n g a upw, t e Cuvo                                 point
Moves   to      thi ment        IO
Maun Componans o} Cussos
    Decla Cuwe                  tn this paut,we declose Vasiobles ad
     etuun        a     Set or values.
2     open This i              thi enwtuna paut ot thu u K A
3    fetch            e d to u b i e tha data aow hy Aow tom a
                      Ghis s    an    enit   paut ot     the cumoi and used        to
lose
5.    Deallocatu           In this    pat , uwe    deliiu the   Cuue         oluhinatiom
                                               iAOwcAS       assodoted with the
amd e l a s all thu Systm
Cset
                       Declake CcuwiKo-uarme         CuusA Jen Select statement
                                                                         -
     Suntan
                                                   lo-
Mysql cuoa w0tks
                                             FETCH        XEMPTY      CLOSE
         Declaue               0pen
       Experiment:
       Experiment No:                          Page No. : 5
                                   NMREC       Date.-
       Ceati database cun,
         C.Aat table tutonials (
        D   int
                  painau key
     Title Vachhan (too)
       Author Vasuchan (4o)
     Date vonchas( 4o0)
     unst vto tutosias values Ct'java','krishna','a019-09-oi');|
    unstat unto tutoials values (a JEreechatds'.'satih,ao19-05-01);
    > inseut uto tutonals Values (3.'Jvaspringe, Amit,ao19-05-o)
 >insot unto tutoials values Cy,'Anduoid.'Ram,'3o19-03-01'); |
i e t into tutorials values (5. Cassandaa'.Puthvi', 2019-04-06
      Select *tiom tutovials
> Ceate table backup
     int
>    Tittl vaachoa (too)
Authos vauthau Cuo)
>Date Vasicha ( +0)
>DEAmNER /
  Experiment                                        PageNo.
  ENperiment No                       NMREC         Date
  eate tkoceduce ample foc )
 gi
  Declae done tmt delault o
     Delae tutorial id ltqea
                                  4Hoialath        tutomal dae vaachai(o)
               tutoxialtitlo,
   Neclae
 DeclasC CuU CLUMO to9 Selett * hom tutona
   Declase        COntinuue   handlos tox mot touund
                                                     Set      done 1
Open       Cuon
   Aabel: loop
                                                 tutonadAuthov,tutorial    Datu
t e t c h Cun lnto     tutoialid, tutoialTitUe
                                               tutoria'        tutlL   ,
inscot    nto       backup valuus ( tutoialtd,
 tutozial Author, tutovial Oote )        ,
  dlonce l         then leawe    label
nd tt
nd Lsep
>est
 rd
 EATmTER
 Callexamplelaot
  Selett faom bockp
  Experiment:_ancedeuas &fanckinns,NMREC            Page No.      1
  Experiment No      O8                             Date.      30/6
                      PROCEDURES 4 PONCTIONs
    poiOceduue iu a Collection o ue. compted so                       stafement
  Stoied inside the database t u
                                 a Sulorouinu o
                                     .
                                                                 a    Subproqvam
  UtheYequlan Computing Janquaqe A piocedusie alwaus
  Contains    a    mame,       panamete lists and S8        Slaemonts
     Synton
              Delimitn gk
              Caeati poLwdue pMowdwe.hame Iw /oUT/inoutj-
              data tupe lpanameten datakype         Poamet-nam
                  een
                  Declanation- Section
                  Eneutable - Sechon
                  End &
                  Delimita
Paxameternname                      Descsiptien
ADCecue- name t                epaasenta thu mame of stored pioeduwe
Paatw                    t apsesents the numben oh poanamtins Can be
                         mee than        onu
De.clanation_Section      tt    uepsRnts   th   deckatiwns of all variabls
e cutable- Sectiont epaesents thu code hor the tunckion
                          enCeuttiem
  Experiment                                      Page No.:
  Experiment No: .                     NMREC      Date.
     Mysql pocedune ponamen has one cf thaee modes.
  IN panamelen -
  His the dehcult mode. Ht takes oa panamoto as ihput, Such
            attibute when we            dahno tt the Calina poqranm
  t o poss an arqument to the Stexed roedne .his
 Pasameters value alwauS petuctld
 OUT pa9ameter
 E       used to paas        a  output tts value Com be
                                  pcoamete   as
 changed inide the stoved pvcaduse ano he chamged
 Value t       pased bock to the Callin progsam               t s noted
 that a pocedue eonnot acces the out pouameteis ininal
 value   when        it   stats
INOUT      panameA
  t i s h e tombinatten tf I             OUT pouameiu t          means the
Callimg pAogaro            Com    pa the axqument         amd the poccdu
Can
Can modka th INOOUT paxamgte»and hm posses he muo
Valu back to the                 calWng pr0gram
To Call Stored poceduue
                Call      pAo cedute n a m e ( pauametuls))
   Experiment.                                 Page No.     83
   Experiment No:              NMREC           Date.-
    Paoceduse without pakame tea -
    Delimitr 4s
    CLeat    proceduie et-menit- student t)
   Beain
   Select o m student-injo whene mauks Yo;
   Se lett Count    ( stud-code) As total student kiom    Student-ufo;
   nd &
  delimite
  Paoceduue wth          paiameten *
  Delimiter s«
   Cueatt prvcedue get-student (no vaat int)
   Beain
  Seletthom Student-info Jimt va 1
  Select count (stud-codle) As tota!- student Kem Student-infp;
   End s
  Delimiter
Jo olekt/ duop stored peocedus t           Mysg!:
DROP PROCEÐURE [IF eustsI paocedune -
                                      nane
  acp poccduue diplcy-masks
                                                       Page No.
   Experiment:.
   Experiment No:
                                         NMREC          Date.-
  Cuate       databse dbms
  use      dbms
  olelimite         f$
  Coeate      pocedlune mypoc C)
 begin
 > Select"hllo"as owhput
    end
c a l l myproc ()
Call      myproc);
 $$
                                             v0nchanC30), paico nt )
                                                                       ;
                               int,   name
CTeate toble        book lid
>$$
  insetinto          book Volues      (t,'a stats', 250);
             book Values (1,usings of toe',150);
  inset uvto
Cveate      proceclue bookprOc t)
begin
Select *aom kook ;
  end
Experiment                                 Page No. :
Experiment No                      NMREC   Date.
             outpu
             hello
       id ame
             states
             ings of   tte   150
        P
 Experiment                                    Page No.   83
 Experiment No
                                   NMREC       Date.
 Call     book pooc t)
    Cheate    puxedioe Poc     w   pt)
 beqin
 declane x nt
stt x-P
Select
   end
$$
   Call proc (a)
>Cieate       p»ocedure   poDca (out   Pint)
  besin
Set      P-io
  Select P
  end
call proc(@P)
     Experiment:Eaar4lauanalLiaa
                                                   Page No.:
  Experiment No      09               NMREC        o
                                                   Date..   20s/
                     CO         Slandling 'n stoeed Psooduu
     my  xovides an easy way to detire hamdl      thot
  handle som
               qcnaial Conditiona Such as waning*
  ecetens to speihic Condilienu eq, Spedfic eau0
                                                 Cods
  Decloing a handlen
      Declae action hamdlr or Conditev-Value stoTemeri
 Mysg        handle paecedence
  An easG aluwayg maps to                a muysql easse Code be cause
in             it is the mest
      Myse                          specifio
 An       Sal stot may     map to mamy         Mysq eoCoolts
thuehore i t i         less &pecijie
 sQLgnCeptiem             o*   an   SQLwang    t   th   shect and tor   a
               SeL    stotes valuos    so t    t hthe
                                                  w mest guecie
Clas et SQ
     Experlment
                                                 Page No. : 4
     Experlment No                    NMREC      Date..
     > Crete table test   (si i t Podmamy Key ( S))
    > delimuten
       Create proceduw1e handler demo C)
       Begin
      Decdane Continue handler fos S9L State 'a300o Set 12=l
    > Setx=I
      tnsert into test   Values (t)
      Set x       2
      iset into test values lO
     Setx3
  End
  mysl        Call handlerdemo ()
    Create procedue pt)
  Beain
  Dedanei int deaut 3
 vetny
    Repeat
 >Begin
|> declaMe continue hondllen fox SqluwOaing
   Begin
Itenative e y            #legal
   end
IP izo then
    Experiment:
                                                            Page No. :        18
    Experiment No
                                          NMREC             Date.-
    leave retng # legal
    End U
    Set 1i-1
     end
     until 4alse end epeat;
    end
                               ltevote witih            matching             label   :
                                                                                         ^etu
    eAD     1308 ( 42000)                          mo
                                                                               in    a    coTIDOE
    Jo Contme            eNcecution    , Set   a   Status   vaahe
     handd, hat chacks endlosing block, to                       invoking the handi
    we wses         th   vasuable   ' DONE' ho      this pupo&e          .
    >Caecde p»ocedusce P t)
    begin
       declare   ivt dehauut 3:
|      oleclare done unt olehault tase
    epe a
     Bean
     Declac Continue                handlun ts Saftoaavimg
         Beain
 Experiment:-                              Page No.   5
ExperimentNo:                      NMREC   Date.
 6et done = TRUE;
       EMD
  I         olone 9 ico then
eave uutnj
end i
      Set i-1-I
      end
                               ;
      unt touse enol epeat
      end