MySQL: How to UPDATE and DELETE data from a TABLE

Поділитися
Вставка
  • Опубліковано 17 жов 2024

КОМЕНТАРІ • 54

  • @BroCodez
    @BroCodez  2 роки тому +16

    UPDATE employees
    SET hourly_pay = 10.25
    WHERE employee_id = 6;
    SELECT * FROM employees;
    DELETE FROM employees
    WHERE employee_id = 6;
    SELECT * FROM employees;

    • @ognjenstevic8637
      @ognjenstevic8637 Рік тому

      I had a problem whit this, I got the following message:
      "Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 0.000 sec 15:41:22 UPDATE employees SET hourly pay = 10.25 WHERE employee_id = 6 Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect."
      That can be fixed by using the following sentence -> "SET SQL_SAFE_UPDATES = 0;". Have a nice day!

    • @just-a-weeb4822
      @just-a-weeb4822 11 місяців тому +1

      Thank you bro🗿💪

  • @gamerslog4135
    @gamerslog4135 Рік тому +2

    If I just waited until the very end, I wouldn't have had to delete my entire TABLE and start again. I accidentally created 2 of the exact same because I did have the SELECT * FROM employees; after creating VALUE (3, "Me", "You", 50.00, "2020-02-28"); so I had 2 copies of it. Could not figure out how to delete it since I could not call on it since it had an exact copy.
    If I waited, I could have only had to delete 2 rows instead of all 8.
    Thank you for making these! Make's learning a hell of a lot easier. You're a life saver and a wizard!

  • @samuraychik111
    @samuraychik111 8 місяців тому +10

    update functioin is not working
    You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.
    To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 0.000 sec

  • @jenshardervingaardlarsen6180
    @jenshardervingaardlarsen6180 11 місяців тому +9

    Great stuff, but why is Plankton only paid 10.50 and Sandy 17? He has experience running a fast food restaurant. As far as I know Sandy is just a scientist. 😅

  • @elliotradley4370
    @elliotradley4370 2 роки тому +1

    Legit the greatest channel for tutorials, keep up the excellent work bro

  • @anayasarintayn6568
    @anayasarintayn6568 4 місяці тому

    u really help alot! thanks to u im not failing in IT!

  • @derman447
    @derman447 2 роки тому +2

    Hey bro, love your videos ! I was wondering if you could make a tutorial series on OpenGL in C++, i know there's a lot of those on youtube but that would be really cool if it was explained by you. I don't mind if you can't, but that would be really appreciated.

  • @markkariuki8354
    @markkariuki8354 Рік тому +2

    after deleting the data from the table how did u regain the data

  • @vstgold1411
    @vstgold1411 16 днів тому

    How do you rearrange data values (rows) from a table in a non-specific order? Like, not alphabetically or in ascending/descending order, but anywhere you want.

  • @ToughNevyHacSoc
    @ToughNevyHacSoc 2 роки тому +1

    Hey bro, I'd be really really really appreciate if you create a video on how we can build an analog clock in java

  • @SaA-nm1op
    @SaA-nm1op 6 місяців тому

    straight to the point . i love it

  • @MeuTube
    @MeuTube 2 роки тому

    Hello bro! Hope you are doing amazing. We are patiently waiting for a React course. Thanks in advance.

  • @cppandjavaandkotlindev
    @cppandjavaandkotlindev 2 роки тому

    hey bro i wonder if you could do a rust full course i know theres other rust courses but they are ba and they skip to complex things so i wonder if you can make one

  • @rahulsaibanala8291
    @rahulsaibanala8291 8 місяців тому +1

    daamn i just deleted all the rows 🤦‍♂, should have waited.

  • @juneroyd.quinimon495
    @juneroyd.quinimon495 Рік тому

    Thank you it really helps me a lot!

  • @BigMitchell1
    @BigMitchell1 11 місяців тому

    This helped my guy. Thanks!

  • @IrfanKhan-bk8jy
    @IrfanKhan-bk8jy 2 роки тому +2

    Bro i'm getting error "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect." while using the update command somebody please help.

    • @mnsvn
      @mnsvn 2 роки тому +2

      it literally says what to do in the error lol

    • @MrGessio
      @MrGessio Рік тому

      do what it says and then close and open again the mysql workbench

    • @dhineshkumar2044
      @dhineshkumar2044 11 місяців тому +4

      go to edit -> preferences -> sql Editor -> lastly you see the dialog box for SAFE UPDATES(rejects UPDATEs AND DELETEs with no restrictions) -> unclick the dialog box close the mySQL workbench -> open the mySQL workbench again -> Run the code and it works simple

    • @wolfethegamer8102
      @wolfethegamer8102 6 місяців тому +1

      @@dhineshkumar2044 Thank you this help so much!

    • @dhineshkumar2044
      @dhineshkumar2044 6 місяців тому +1

      @@wolfethegamer8102 no worries bro

  • @saimoomsikto9383
    @saimoomsikto9383 Рік тому +1

    why cant you use "modify" or "alter" to update or delete data?

  • @jenis-01
    @jenis-01 2 роки тому

    Please can you make C++ Data structures video like for Java?? Please!!!!!!!!!! You explain so good

  • @andredubbs4854
    @andredubbs4854 2 роки тому

    hey bro, great video as per usual. thanks alot!

  • @PanktiParmar-nt2rl
    @PanktiParmar-nt2rl Місяць тому

    If all hourly pay is changed to 10.25 then how to undo it so that we can get the original hourly pay of the employees

  • @recon6660
    @recon6660 2 роки тому

    love your contents always.

  • @emrebilen1395
    @emrebilen1395 2 місяці тому

    "alter table employees add primary key (userid)" use this for safe update error. But userid must include all unique and not null values.

  • @computerengineercemberkcra3490
    @computerengineercemberkcra3490 2 роки тому

    You are a legend thanks

  • @xudayfitechoffiaicl5125
    @xudayfitechoffiaicl5125 2 роки тому

    Thanks teacher

  • @elizataylor19
    @elizataylor19 3 місяці тому

    Im a beginner , incidentally made null values in employee_id column for all, how do i replace them with number values. Thanks anyone who hleps

  • @arshitaanchaliya1583
    @arshitaanchaliya1583 10 днів тому

    how to undo the update query ?

  • @houdahammachi9240
    @houdahammachi9240 2 місяці тому

    update fonction is not working
    SET SQL_SAFE_UPDATES = 0;
    disable safe update

  • @lunivers2135
    @lunivers2135 2 роки тому

    thank you Bro Code😊

  • @abdulbasit9364
    @abdulbasit9364 2 дні тому

    Bro tell us about give user access in sql

  • @Harzit
    @Harzit Рік тому

    Bro, you da best

  • @kamal9294
    @kamal9294 2 роки тому

    Thank you bro

  • @TranXuanDucPH
    @TranXuanDucPH Місяць тому

    23:08:34 UPDATE employees SET hourly_pay = 10.50 , hire_date = "2023-01-06" WHERE employee_id = 4 Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 0.000 sec

    • @arsenart648
      @arsenart648 Місяць тому

      you can use the:
      SET SQL_SAFE_UPDATES = 0;
      run it > do whatever cahnge you want
      BUT in the end of your work set it back to 1 since it is a useful safe barrier
      SET SQL_SAFE_UPDATES = 1;

  • @amniat762
    @amniat762 8 місяців тому

    i love bro code

  • @onenobu4945
    @onenobu4945 20 днів тому

    Tried this and I get ''invalid syntax near "WHERE"

  • @MP-me5vl
    @MP-me5vl Рік тому

    It does not work for me. I need help please

  • @kaviyasekar2578
    @kaviyasekar2578 2 роки тому

    Do a tutorial on Android studio using java pls

  • @v4porwave803
    @v4porwave803 4 місяці тому

    pov: how plankton villain arc started

  • @OliviaChen0806
    @OliviaChen0806 2 роки тому

    First Finally🎉

  • @mohaymenul-islam
    @mohaymenul-islam 9 днів тому

    ✅ 9th October - 2024

  • @OpinionOfX
    @OpinionOfX Рік тому

    Ravish kumar official

  • @muhammaddiymurodov9112
    @muhammaddiymurodov9112 2 роки тому

    hello bro code, your code is not working! from c lessons (string functions) ;
    #include
    #include
    int main(){
    char string1[] = "Bro";
    char string2[] = "Code";
    strlwr(string1); // converts a string to lowercase
    //strupr(string1); // converts a string to uppercase
    //strcat(string1, string2); // appends string2 to end of string1
    //strncat(string1, string2, 1); // appends n characters from string2 to string1
    //strcpy(string1, string2); // copy string2 to string1
    //strncpy(string1, string2, 2); // copy n characters of string2 to string1
    //strset(string1, '?'); //sets all characters of a string to a given character
    //strnset(string1, 'x', 1); //sets first n characters of a string to a given character
    //strrev(string1); //reverses a string
    //int result = strlen(string1); // returns string length as int
    //int result = strcmp(string1, string2); // string compare all characters
    //int result = strncmp(string1, string2, 1); // string compare n characters
    //int result = strcmpi(string1, string1); // string compare all (ignore case)
    //int result = strnicmp(string1, string1, 1); // string compare n characters (ignore case)
    printf("%s", string1);
    /*
    if(result == 0)
    {
    printf("These strings are the same");
    }
    else
    {
    printf("These strings are not the same");
    }
    */
    return 0;
    }
    it says:
    strlwr(string1); // converts a string to lowercase
    | ^~~~~~
    | strstr
    stringFucntions.c:6:9: warning: unused variable 'string2' [-Wunused-variable]
    6 | char string2[] = "Code";
    | ^~~~~~~
    pls help

  • @ahamedshathelegend1409
    @ahamedshathelegend1409 2 роки тому

    for the algorithm
    #youtubevideos.
    #youtubemusic.
    #youtubechannel.
    #video.
    #live.
    #youtubecreator.
    #subscribe.
    #viral.

  • @cppandjavaandkotlindev
    @cppandjavaandkotlindev 2 роки тому

    hey bro i wonder if you could do a rust full course i know theres other rust courses but they are ba and they skip to complex things so i wonder if you can make one