• -> insert into bemorlar0 (id, fish, delele_qilingan_muolajalar) -> values (old.id, old.fish, old.qilingan_muolajalar); -> end;//
  • 14.16 – rasm. bemorlar0
  • -> declare c varchar(60); -> select user() into c; -> insert into bemorlar0 (id, fish, delete_yoshi, delete_qilingan_muolajalar)
  • Raqamli texnologiyalar konvergensiyasi kafedrasi




    Download 1,03 Mb.
    bet7/8
    Sana17.05.2024
    Hajmi1,03 Mb.
    #239917
    1   2   3   4   5   6   7   8
    Bog'liq
    MBYULDOSHEV5-ISH (1)

    4. Before delete trigger

      1. bemorlar_ochirish_oldin triggerini yaratamiz;



    create trigger bemorlar_ochirishdan_oldin
    -> before delete
    -> on bemorlar for each row
    -> begin
    -> declare c varchar(50);
    -> select user() into c;
    -> insert into bemorlar0 (id, fish, delele_qilingan_muolajalar)
    -> values (old.id, old.fish, old.qilingan_muolajalar);
    -> end;//



    14.15 – rasm. bemorlar_ochirish_oldin triggerini yaratish

    delete from bemorlar0 where id=5;
    -> //
    Yaratgan triggerimizni ishlatamiz va natijasini bemorlar0 jadvalida ko’ramiz; ya’ni biz trigger yordamida ID 5 ga teng satrni o’chirdik

    14.16 – rasm. bemorlar0 jadvalidan satr o`chirish natijasi
    5. After delete trigger
    5.1. bemorlar_ochirish_keyin triggerini yaratamiz;


    delimiter //
    mysql> create trigger bemorlar_ochirishdan_keyin
    -> after delete
    -> on bemorlar for each row
    -> begin
    -> declare c varchar(60);
    -> select user() into c;
    -> insert into bemorlar0 (id, fish, delete_yoshi, delete_qilingan_muolajalar)
    -> values (old.id, old.fish, old.qilingan_muolajalar);
    -> end;//

    14.17– rasm. bemorlar_ochirish_keyin triggerini yaratish

    delete from bemorlar0 where id=1;
    -> //
    Yaratgan triggerimizni ishlatamiz va natijasini bemorlar0 jadvalida ko‘ramiz; yani biz trigger yordamida ID 1 ga teng satrni ham o‘chirdik



    14.18 – rasm. bemorlar0 jadvalidan satr o‘chirish natijasi
    6. drop trigger:
    6.1. Oldingi misollarda yaratgan bemorlar_ochirishdan_oldin triggerini o‘chiramiz;

    Download 1,03 Mb.
    1   2   3   4   5   6   7   8




    Download 1,03 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Raqamli texnologiyalar konvergensiyasi kafedrasi

    Download 1,03 Mb.