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

MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?Olivia Kresic
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Seta Wicaksana
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfJos Voskuil
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCRashishs7044
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607dollysharma2066
 
Investment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy CheruiyotInvestment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy Cheruiyotictsugar
 
Kenya’s Coconut Value Chain by Gatsby Africa
Kenya’s Coconut Value Chain by Gatsby AfricaKenya’s Coconut Value Chain by Gatsby Africa
Kenya’s Coconut Value Chain by Gatsby Africaictsugar
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Pereraictsugar
 
Organizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessOrganizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessSeta Wicaksana
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfpollardmorgan
 
IoT Insurance Observatory: summary 2024
IoT Insurance Observatory:  summary 2024IoT Insurance Observatory:  summary 2024
IoT Insurance Observatory: summary 2024Matteo Carbone
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCRashishs7044
 
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdfNewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdfKhaled Al Awadi
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesKeppelCorporation
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCRashishs7044
 
India Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportIndia Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportMintel Group
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Servicecallgirls2057
 
Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Anamaria Contreras
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMintel Group
 

Recently uploaded (20)

MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdf
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
 
Investment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy CheruiyotInvestment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy Cheruiyot
 
Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCREnjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
 
Kenya’s Coconut Value Chain by Gatsby Africa
Kenya’s Coconut Value Chain by Gatsby AfricaKenya’s Coconut Value Chain by Gatsby Africa
Kenya’s Coconut Value Chain by Gatsby Africa
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Perera
 
Organizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessOrganizational Structure Running A Successful Business
Organizational Structure Running A Successful Business
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
 
IoT Insurance Observatory: summary 2024
IoT Insurance Observatory:  summary 2024IoT Insurance Observatory:  summary 2024
IoT Insurance Observatory: summary 2024
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
 
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdfNewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation Slides
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR
 
India Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportIndia Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample Report
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
 
Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 Edition
 

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