MySQL: STORED PROCEDURES

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • #MySQL #tutorial #course
    ---- Example 1 ----
    DELIMITER $$
    CREATE PROCEDURE get_customers()
    BEGIN
    SELECT * FROM customers;
    END $$
    DELIMITER ;
    CALL get_customers();
    DROP PROCEDURE get_customers;
    ---- Example 2 ----
    DELIMITER $$
    CREATE PROCEDURE find_customer(IN id INT)
    BEGIN
    SELECT *
    FROM customers
    WHERE customer_id = id;
    END $$
    DELIMITER ;
    ---- Example 3 ----
    DELIMITER $$
    CREATE PROCEDURE find_customer(IN f_name VARCHAR(50),
    IN l_name VARCHAR(50))
    BEGIN
    SELECT *
    FROM customers
    WHERE first_name = f_name AND last_name = l_name;
    END $$
    DELIMITER ;

ความคิดเห็น • 55

  • @BroCodez
    @BroCodez  ปีที่แล้ว +24

    ----- Example 1 -----
    DELIMITER $$
    CREATE PROCEDURE get_customers()
    BEGIN
    SELECT * FROM customers;
    END $$
    DELIMITER ;
    CALL get_customers();
    DROP PROCEDURE get_customers;
    ----- Example 2 -----
    DELIMITER $$
    CREATE PROCEDURE find_customer(IN id INT)
    BEGIN
    SELECT *
    FROM customers
    WHERE customer_id = id;
    END $$
    DELIMITER ;
    ----- Example 3 -----
    DELIMITER $$
    CREATE PROCEDURE find_customer(IN f_name VARCHAR(50),
    IN l_name VARCHAR(50))
    BEGIN
    SELECT *
    FROM customers
    WHERE first_name = f_name AND last_name = l_name;
    END $$
    DELIMITER ;

    • @annam3533
      @annam3533 ปีที่แล้ว

      Great

    • @MasterZhao
      @MasterZhao 8 หลายเดือนก่อน

      Can you do an example where you DECLARE variables and use CONTINUE HANDLER FOR SQLEXCEPTION?

  • @dharmawangsa9592
    @dharmawangsa9592 ปีที่แล้ว +17

    finnaly someone explain stored procedure clearly, thx bro. please more content

  • @renyirish
    @renyirish ปีที่แล้ว +8

    Wow, I love when people simplify things! No need for a giant table with a giant column to give an example. Thank you soooo much, very well explained ❤

  • @yvonnetatah2084
    @yvonnetatah2084 ปีที่แล้ว +3

    Best video on the subject so far. Thank you!

  • @seyonmahendran7182
    @seyonmahendran7182 8 หลายเดือนก่อน +10

    Please come to our university you deserve to be a lecturer😂

  • @smtxtv
    @smtxtv 3 หลายเดือนก่อน +1

    Clear, concise, direct....but you know that. Thx !

  • @CristianIordache22091996
    @CristianIordache22091996 ปีที่แล้ว +2

    I like so much the way you explain everything

  • @philipking1788
    @philipking1788 5 หลายเดือนก่อน

    Thanks for explaining this so clearly. I now understand the changing of the DELIMITER thing.

  • @ruthladenegan4075
    @ruthladenegan4075 9 หลายเดือนก่อน

    Always looking forward to your post. You make sql so easy

  • @sk00pidis
    @sk00pidis ปีที่แล้ว +4

    This info came just the right time :) Thank you bro!

  • @gabrielodiase7357
    @gabrielodiase7357 ปีที่แล้ว

    This is absolutely amazing. Thanks

  • @mrhhh693
    @mrhhh693 9 หลายเดือนก่อน +3

    😅 To be honest, this lesson is more clear than the one from Meta Database Enginnering course. Thanks so much! ❤

  • @khanhduluong4355
    @khanhduluong4355 3 หลายเดือนก่อน

    What a great explanation! Very clear, straight and easy to understand. Thank you so much!

  • @pabloqp7929
    @pabloqp7929 ปีที่แล้ว

    Hey @BroCode! Great playlist. Love your fancy dark theme! Let me ask since you didn't cover cursors, are they any good? Cheers

  • @aldrinjohnencina6153
    @aldrinjohnencina6153 3 หลายเดือนก่อน

    thank you so much clear explaination.

  • @AronLuchan
    @AronLuchan ปีที่แล้ว +1

    Thank you very much!

  • @al-cadaalachannel3194
    @al-cadaalachannel3194 3 หลายเดือนก่อน

    Thanks ❤ for explaining clearly and simply. I have never seen this explanation before

  • @khantechsolution
    @khantechsolution 10 หลายเดือนก่อน +1

    great sir

  • @lubna99
    @lubna99 9 หลายเดือนก่อน

    great .. thank u alot

  • @teshalex
    @teshalex 11 หลายเดือนก่อน

    Thank you, it was easy to understand

  • @chathurid
    @chathurid ปีที่แล้ว

    Thank You so much!!

  • @ruthladenegan4075
    @ruthladenegan4075 9 หลายเดือนก่อน

    You are the best

  • @rominasepulveda570
    @rominasepulveda570 11 หลายเดือนก่อน

    great video

  • @ahmadzaini1297
    @ahmadzaini1297 หลายเดือนก่อน

    Thx bro, even my lecture just ask me to find self the theory, bro you're my hero 😢

  • @user-bt3zq2sl6r
    @user-bt3zq2sl6r 7 หลายเดือนก่อน

    thank you so much

  • @sahaninimesha9895
    @sahaninimesha9895 11 หลายเดือนก่อน

    Thnks a lot❤

  • @tenebrae1191
    @tenebrae1191 ปีที่แล้ว

    👏👏

  • @nagendradevara1
    @nagendradevara1 ปีที่แล้ว +3

    Please continue this MySql series

  • @nicholasiliev
    @nicholasiliev 6 หลายเดือนก่อน

    Thanks bro!

  • @SistaYana-ru1yc
    @SistaYana-ru1yc ปีที่แล้ว

    I love you 🥰

  • @thunderhamilton1
    @thunderhamilton1 ปีที่แล้ว

    Having issue with code in which for some reason. I successfully made 2 stored procedures in a database however the one I did for a parameter that's supposed to be for when finding a particular date within the table when I call the stored procedure it's returns empty set. Yet when I call an asp for all records it'll do so successfully

  • @rubysrivastava2288
    @rubysrivastava2288 ปีที่แล้ว +1

    pls explain OUT and INOUT procedures as well

  • @pranatianuse243
    @pranatianuse243 ปีที่แล้ว

    HI,
    Tell me what if I want to provide Customerid 1 and 2 at one time means 1,2 then what will be my sp?

  • @vanshgrover_19
    @vanshgrover_19 6 หลายเดือนก่อน

    Great explanation, but what about stored procedure using OUT parameter??

  • @productivityaccount7705
    @productivityaccount7705 3 หลายเดือนก่อน

    Can you please do a video on cursor

  • @cusematt23
    @cusematt23 4 หลายเดือนก่อน

    ill stick with the dollar signs because i think that's cooler. 😂

  • @parajf
    @parajf หลายเดือนก่อน

    How to update (refresh) stored procedure in Mysql workbench every minute (automate)

  • @fearless6141
    @fearless6141 8 หลายเดือนก่อน

    Can we use date function as parameter

  • @ekcanok2412
    @ekcanok2412 ปีที่แล้ว

    Can this be used on microsoft sql server?

  • @SIDEKICKONYOUTUBE
    @SIDEKICKONYOUTUBE 8 หลายเดือนก่อน

    im confused. you have to change the delimiter every time ?
    why hasn't MySQL made a fix for this ?

  • @HoaNguyen-uq8vh
    @HoaNguyen-uq8vh 9 หลายเดือนก่อน

    How to debug Stored Procedure in mySQL workbench

  • @phongtranquoc7557
    @phongtranquoc7557 ปีที่แล้ว

    whats the differences between create functions and procedures guys? =

  • @ATGalaxy94
    @ATGalaxy94 8 หลายเดือนก่อน

    Where can i find this database ???

  • @queryhsje7514
    @queryhsje7514 ปีที่แล้ว +1

    Whats the difference between stored Procedure and Views? I'm confused.

    • @TheAnimeSounds
      @TheAnimeSounds ปีที่แล้ว +1

      Procedure is just an action that executes your statements
      Views are virtual tables (your rensponses), unlike normal tables that hold data and are stored in Databases, views create tables with data filled dynamically on the fly. You use those if you dont really need store specific tables, but said tables can help ya with solving some problem / calculation.

    • @queryhsje7514
      @queryhsje7514 ปีที่แล้ว

      @@TheAnimeSounds Oh ok, thanks!

  • @sundaypodcom
    @sundaypodcom ปีที่แล้ว

    Why varchar is "WarCHAR" and not "WarKar" when character is "Karactor"

  • @theBATfamiliar
    @theBATfamiliar 11 หลายเดือนก่อน

    Thanks a lot for this tutorial :)

  • @EvoRudzi
    @EvoRudzi 11 หลายเดือนก่อน

    those using ssms CALL is EXEC

  • @cbbcbb6803
    @cbbcbb6803 ปีที่แล้ว

    Don't you have to use a database first?

    • @mitigozman-pop2
      @mitigozman-pop2 ปีที่แล้ว

      He did create a database. Otherwise he wouldn't be able to extract data. He did so in previous videos of this series.

  • @moe583
    @moe583 9 หลายเดือนก่อน

    Can you please do a course on developing a web application with nodeJS, there isn't any good tutorials on youtube for that and I think you would be great at breaking it down.