SlideShare a Scribd company logo
1 of 47
Code
Begin
   declare c anchor empPr.salary;
  select salary into c from empPr where id=2;
  if(c>40000) then
      update empPr set salary=c+1000 where
      id=2;
  end if;
end
Code
begin
  declare c anchor empPr.salary;
  select salary into c from empPr where id=2 ;
  if(c>40000) then
      update empPr set salary=c+1000 where id=2;
  else
      update empPr set salary=c+500 where id=2;
  end if;
end ;
Code
begin
  declare c anchor empPr.salary;
   declare bonus int;
  select salary into c from empPr where id=2 ;
  case c
       when 50000 then
               set bonus=c+1000;
       when 30000 then
              set bonus=c+500;
       else
              set bonus=c;
  end case;
  update empPr set salary=bonus where id=2;
end ;
Code
begin
   declare c anchor empPr.salary;
    declare bonus int;
   select salary into c from empPr where id=2 ;
   case
         when C<=40000 then
                   set bonus=c+500;
         when c<=50000 then
                   set bonus=c+1000;
         else
                    set bonus=c+2000;
    end case;
   update empPr set salary=bonus where id=2;
end ;
Code
create type emp as row anchor row of empPr;
BEGIN
   declare e1 emp;
   L:
       for e1 as select * from empPr DO
               if( e1.salary < 30000) THEN
                        Iterate L;
                end if;
               update empPr set salary=e1.salary+1000
       where id=e1.id;
       end for L;
END;
Code
create type e1 as row anchor row of empPr;
BEGIN
   declare total_sal int;
   set total_sal = 0;
    ADD :
         for e1 as select * from empPr DO
                   Set total_sal=total_sal+e1.salary;
                  if( total_sal >100000)
                            leave ADD:
                  end if;
          end for ADD;
END;
8
Update employee salary based on conditions
Update employee salary based on conditions
Update employee salary based on conditions
Update employee salary based on conditions
Update employee salary based on conditions

More Related Content

Viewers also liked

The group data net
The group data netThe group data net
The group data netlalupu
 
افات امتثال السيولة Maan
افات امتثال السيولة Maanافات امتثال السيولة Maan
افات امتثال السيولة MaanMaan Barazi
 
Cravatte, chignon e social web_ Quattro @Roverbella
Cravatte, chignon e social web_ Quattro @RoverbellaCravatte, chignon e social web_ Quattro @Roverbella
Cravatte, chignon e social web_ Quattro @RoverbellaValentina Tosi
 
114. mc k part 3 hbo
114. mc k part 3   hbo114. mc k part 3   hbo
114. mc k part 3 hboHispros
 
الثورة السورية بين العنف واللاعنف
الثورة السورية بين العنف واللاعنفالثورة السورية بين العنف واللاعنف
الثورة السورية بين العنف واللاعنفMuhammad Naseh Abdulla
 
20131019 生物物理若手 Journal Club
20131019 生物物理若手 Journal Club20131019 生物物理若手 Journal Club
20131019 生物物理若手 Journal ClubMed_KU
 
Molekulární vodík
Molekulární vodíkMolekulární vodík
Molekulární vodíkDavid Sach
 
8 Years Ago, and 8 Years Later Again
8 Years Ago, and 8 Years Later Again8 Years Ago, and 8 Years Later Again
8 Years Ago, and 8 Years Later AgainMaria Fatima
 
Wspei Supports And Services
Wspei Supports And ServicesWspei Supports And Services
Wspei Supports And ServicesEvelyn Azbell
 
مؤشر كتابة النص التفعيلي
مؤشر كتابة النص التفعيليمؤشر كتابة النص التفعيلي
مؤشر كتابة النص التفعيليAbu Ali Talluza
 
Bailes 100311035514-phpapp02
Bailes 100311035514-phpapp02Bailes 100311035514-phpapp02
Bailes 100311035514-phpapp02mcardenas2020
 
Manuaalinen purkuilmaventtiili
Manuaalinen purkuilmaventtiiliManuaalinen purkuilmaventtiili
Manuaalinen purkuilmaventtiiliCarolina Morales
 

Viewers also liked (19)

Allians för sjukvården i sörmland 5 år vid makten
Allians för sjukvården i sörmland   5 år vid maktenAllians för sjukvården i sörmland   5 år vid makten
Allians för sjukvården i sörmland 5 år vid makten
 
The group data net
The group data netThe group data net
The group data net
 
افات امتثال السيولة Maan
افات امتثال السيولة Maanافات امتثال السيولة Maan
افات امتثال السيولة Maan
 
Proyecto Ocaña
Proyecto OcañaProyecto Ocaña
Proyecto Ocaña
 
Cravatte, chignon e social web_ Quattro @Roverbella
Cravatte, chignon e social web_ Quattro @RoverbellaCravatte, chignon e social web_ Quattro @Roverbella
Cravatte, chignon e social web_ Quattro @Roverbella
 
Connectis en Castilla y León Económica
Connectis en Castilla y León EconómicaConnectis en Castilla y León Económica
Connectis en Castilla y León Económica
 
Tivi+
Tivi+Tivi+
Tivi+
 
Session 43 Mats Hollander
Session 43 Mats HollanderSession 43 Mats Hollander
Session 43 Mats Hollander
 
114. mc k part 3 hbo
114. mc k part 3   hbo114. mc k part 3   hbo
114. mc k part 3 hbo
 
الثورة السورية بين العنف واللاعنف
الثورة السورية بين العنف واللاعنفالثورة السورية بين العنف واللاعنف
الثورة السورية بين العنف واللاعنف
 
السكان
السكانالسكان
السكان
 
20131019 生物物理若手 Journal Club
20131019 生物物理若手 Journal Club20131019 生物物理若手 Journal Club
20131019 生物物理若手 Journal Club
 
Molekulární vodík
Molekulární vodíkMolekulární vodík
Molekulární vodík
 
8 Years Ago, and 8 Years Later Again
8 Years Ago, and 8 Years Later Again8 Years Ago, and 8 Years Later Again
8 Years Ago, and 8 Years Later Again
 
Wspei Supports And Services
Wspei Supports And ServicesWspei Supports And Services
Wspei Supports And Services
 
مؤشر كتابة النص التفعيلي
مؤشر كتابة النص التفعيليمؤشر كتابة النص التفعيلي
مؤشر كتابة النص التفعيلي
 
Bailes 100311035514-phpapp02
Bailes 100311035514-phpapp02Bailes 100311035514-phpapp02
Bailes 100311035514-phpapp02
 
Almassar2
Almassar2Almassar2
Almassar2
 
Manuaalinen purkuilmaventtiili
Manuaalinen purkuilmaventtiiliManuaalinen purkuilmaventtiili
Manuaalinen purkuilmaventtiili
 

More from Abha Damani (20)

Unit2
Unit2Unit2
Unit2
 
Unit6
Unit6Unit6
Unit6
 
Unit5
Unit5Unit5
Unit5
 
Unit4
Unit4Unit4
Unit4
 
Unit3
Unit3Unit3
Unit3
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
 
Ch14
Ch14Ch14
Ch14
 
Ch12
Ch12Ch12
Ch12
 
Ch11
Ch11Ch11
Ch11
 
Ch10
Ch10Ch10
Ch10
 
Ch08
Ch08Ch08
Ch08
 
Ch01 enterprise
Ch01 enterpriseCh01 enterprise
Ch01 enterprise
 
3 data mgmt
3 data mgmt3 data mgmt
3 data mgmt
 
2 it supp_sys
2 it supp_sys2 it supp_sys
2 it supp_sys
 
1 org.perf it supp_appl
1 org.perf it supp_appl1 org.perf it supp_appl
1 org.perf it supp_appl
 
Managing and securing the enterprise
Managing and securing the enterpriseManaging and securing the enterprise
Managing and securing the enterprise
 
Ch6
Ch6Ch6
Ch6
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 4
Unit 4Unit 4
Unit 4
 
Unit 5
Unit 5Unit 5
Unit 5
 

Recently uploaded

The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyEthan lee
 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Roland Driesen
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableDipal Arora
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsMichael W. Hawkins
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Dave Litwiller
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLSeo
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth MarketingShawn Pang
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsApsara Of India
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdftbatkhuu1
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayNZSG
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Dipal Arora
 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insightsseribangash
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMANIlamathiKannappan
 
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒anilsa9823
 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...Paul Menig
 
Unlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfUnlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfOnline Income Engine
 
Best Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaBest Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaShree Krishna Exports
 

Recently uploaded (20)

The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael Hawkins
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdf
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insights
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMAN
 
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...
 
Unlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfUnlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdf
 
Best Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaBest Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in India
 

Update employee salary based on conditions

  • 1.
  • 2.
  • 3.
  • 4.
  • 5. Code Begin declare c anchor empPr.salary; select salary into c from empPr where id=2; if(c>40000) then update empPr set salary=c+1000 where id=2; end if; end
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Code begin declare c anchor empPr.salary; select salary into c from empPr where id=2 ; if(c>40000) then update empPr set salary=c+1000 where id=2; else update empPr set salary=c+500 where id=2; end if; end ;
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Code begin declare c anchor empPr.salary; declare bonus int; select salary into c from empPr where id=2 ; case c when 50000 then set bonus=c+1000; when 30000 then set bonus=c+500; else set bonus=c; end case; update empPr set salary=bonus where id=2; end ;
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. Code begin declare c anchor empPr.salary; declare bonus int; select salary into c from empPr where id=2 ; case when C<=40000 then set bonus=c+500; when c<=50000 then set bonus=c+1000; else set bonus=c+2000; end case; update empPr set salary=bonus where id=2; end ;
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34. Code create type emp as row anchor row of empPr; BEGIN declare e1 emp; L: for e1 as select * from empPr DO if( e1.salary < 30000) THEN Iterate L; end if; update empPr set salary=e1.salary+1000 where id=e1.id; end for L; END;
  • 35.
  • 36.
  • 37. Code create type e1 as row anchor row of empPr; BEGIN declare total_sal int; set total_sal = 0; ADD : for e1 as select * from empPr DO Set total_sal=total_sal+e1.salary; if( total_sal >100000) leave ADD: end if; end for ADD; END;
  • 38.
  • 39.
  • 40.
  • 41.
  • 42. 8