SQL Query Basics: Insert, Select, Update, and Delete

Поделиться
HTML-код
  • Опубликовано: 18 янв 2020
  • Without question the most used statements in SQL are the Insert, Select, Update, and Delete statements. They make up the core foundation for any database work.
    Hope you enjoyed the video!
    Create Tables Video:
    • How to Design and Crea...
    Check out this code here:
    github.com/engineer-man/youtu...
    Join my Discord server to chat with me:
    / discord
    Check out some code on my GitHub:
    github.com/realtux
    github.com/engineer-man/youtube
    Come visit us on Reddit:
    / engineerman
    Other Social:
    / _engineerman
    / engineermanyt
  • НаукаНаука

Комментарии • 50

  • @pierogii_
    @pierogii_ 4 года назад +44

    This taught me more than a $2,000 university database basics class. Thanks man!

  • @ZacKoch
    @ZacKoch 4 года назад +3

    Great video! Everyone should know SQL basics, you're going to run into a database no matter what technical career path you choose.

  • @thomasterp-madsen3946
    @thomasterp-madsen3946 4 года назад

    Great video, as always - I'll check out your other SQL videos right away; you're great at explaining everything in just the right amount of detail AND in a perfect tempo. Thank you so much!

  • @filipomazic8823
    @filipomazic8823 4 года назад +16

    sql injection video incomming? :)

  • @MrGFYne1337357
    @MrGFYne1337357 4 года назад +5

    Dude you explain things so well and it is so much easier for me to understand,, ty. sincerely ty.

  • @justnbody.5934
    @justnbody.5934 4 года назад

    just found your channel and i’m learning so much from it MASSIVE THANK YOU BRO ❤️❤️

  • @MatiEP09
    @MatiEP09 2 месяца назад

    im having tommorow an exam on this, nice explanation!

  • @6s6
    @6s6 4 года назад

    Looking forward to more DB videos. Subscribed.

  • @user-hb2df6nn2y
    @user-hb2df6nn2y 2 месяца назад

    you are great man but please add the possibility to activate the subtitles, you speak fast and we are not all english native speakers, so they help. have a nice day and thank you ;)

  • @mayne4672
    @mayne4672 2 года назад +1

    Thanks broo!! I wish that I'll get the teachers like you...Keep it up buddie!!!

  • @nidhi327
    @nidhi327 4 года назад +1

    I knew the basics. But never used limit and transaction..thanks EM

  • @kevinc.7730
    @kevinc.7730 4 года назад

    Apologies if you already made one, but an ATOM tips and tricks vid would be much appreciated. Love the content, Thanks!!

  • @ayeshairshad1298
    @ayeshairshad1298 4 года назад

    I am outreaching you on behalf of NCache by Alachisoft. Ncache is a 100% .NET / .NET Core distributed cache.
    We have been following your RUclips Channel since quite a while and we really can’t help appreciating the amazing work you are doing. We saw some Tutorials, How-To guides and Tips on your channel, so we would really want to have an alliance with you for some similar videos.
    I hope you don’t mind if we talk further about this.

  • @HadToChangeMyName_YoutubeSucks
    @HadToChangeMyName_YoutubeSucks 4 года назад +4

    A shortcut for the insert of multiple rows, insert into people (name, age) values ('john', 21), ('fred, 22), ('albert', 23);

  • @punky_574
    @punky_574 2 месяца назад

    Very helpful, thank you!

  • @blanketfish
    @blanketfish 4 года назад

    Love your videos. Could you do a video on "ON DELETE" clause when using foreign keys or foreign keys in general?

  • @farxx5628
    @farxx5628 3 года назад

    Thank you so much ! u saved my exam

  • @PhG1961
    @PhG1961 4 года назад

    Wonderfull !! We want more..... !!

  • @morning5tarr
    @morning5tarr 4 года назад +2

    Thanks,
    If you could explain about how internals work , would be great.

  • @DerekWelchElectric
    @DerekWelchElectric 4 года назад

    Thank you EM!

  • @siarog1290
    @siarog1290 3 года назад

    give this man a cookie :D great Video

  • @adparikhyt8859
    @adparikhyt8859 4 года назад

    That's help me in computer application thanks bro

  • @misterinc6323
    @misterinc6323 4 года назад

    I just started to learn python and a bunch of things related to data science 1 month ago. I really appreciate your video. I was wondering if you could tell me what IDE are you using for SQL and asking for doing a video for noSQL. Cheers

  • @cyberkid7690
    @cyberkid7690 4 года назад

    Hi Engineer Man, thank you for such a great informative video, have you build any courses on SQL or any other programming language.

  • @Javier-ue5nt
    @Javier-ue5nt 4 года назад

    Nice video :D

  • @stephenwatson8125
    @stephenwatson8125 3 года назад

    Hello Engineer man if you could help I would appreciate it.
    How do you syntax sql to display output in a decimal field when using number like 2,244.90 and not having the database erroring the comma thinking it is an extra field.

  • @arielapp9469
    @arielapp9469 4 года назад

    that happened to me, I wrote a database update php page, obviously one of the functions was: delete from table_name, it took me a while to understand that, I forgot to write down the where part, and I kept deleting my table, goos thing I was in the development stage, and not in the production stage :)

  • @peremokechristopher7759
    @peremokechristopher7759 2 года назад

    Thanks Engineer Man for this Vidoe.
    I have issue using the UPDATE statement. Its a simple student database, I used fetchdata to display student's name and age on thier dashboard.
    Then I decide to create room for name editing, so they click edit to change thier name with UPDATE statement but immediately it updates, the variables for age and name will be showing error like Undefine variable..... please help me. Thanks

  • @mohamedelhagib
    @mohamedelhagib 4 месяца назад

    Hi can you help me how can i delet using this select
    SELECT PRO.CDPRO,TRA.NHORAS,TRA.CDEMP
    FROM PROYECTO PRO,TRABAJA TRA
    WHERE TRA.CDPRO = PRO.CDPRO
    group by PRO.CDPRO,TRA.NHORAS,TRA.CDEMP
    HAVING SUM(NHORAS)=0;
    this is the incial select and i need to transforme it into delete how can a i do it? thanks

  • @northendtrooper
    @northendtrooper 4 года назад

    Question. When rolling back. Does it rollback to the start of the transaction or only the most recent command you ran?

  • @bokkenka
    @bokkenka 4 года назад

    Nice video. Thanks. Is there a way to select a number of random records?

    • @EngineerMan
      @EngineerMan  4 года назад +1

      If performance doesn't matter to you, adding "order by rand()" at the end should be fine. If performance does matter, then the solution is based on the data (size, contiguous or non-contiguous surrogate keys, and others). Generally speaking, the solution is to get the max id of the table, multiply it by rand(), get the nearest whole number, then select the record that is either exactly that id or the nearest one.

  • @BloodlyKill
    @BloodlyKill 4 года назад

    can u make a video on git local and repository

  • @brandon-22
    @brandon-22 4 года назад

    8:52 impressive can you do this in sql server as well as it every query is transaction already? like can i delete stuff there, do a select and then commit/rollback based on my liking?

    • @EngineerMan
      @EngineerMan  4 года назад

      I believe sql server is "begin transaction", otherwise it's the same.

  • @capjus
    @capjus 4 года назад

    Who is watching this in 2020?? :D

  • @noweare1
    @noweare1 4 года назад

    Are you coding in python and just using a sql libray. Sorry, I do not know what SQL is. I know databases and fields and queries but is it a language all its own ?

    • @EngineerMan
      @EngineerMan  4 года назад

      SQL (Structured Query Language) is its own thing. The database understands SQL directly.

  • @hashkeeper
    @hashkeeper 3 года назад

    kalix from uruguay lol

  • @petros_adamopoulos
    @petros_adamopoulos 4 года назад

    Who in his sane mind would have an "age" column in a database instead of date of birth... I mean, am I the crazy one here? Thanks for the video though, I learned a few things I might remember the day I'm forced to use SQL.

    • @EngineerMan
      @EngineerMan  4 года назад

      It was just an example, but, one such table might be a table containing medical screenings where it's important to store the age at the time of the screening.

  • @prarcosgaming-wwe2423
    @prarcosgaming-wwe2423 2 года назад

    shubham pundir

  • @HadToChangeMyName_YoutubeSucks
    @HadToChangeMyName_YoutubeSucks 4 года назад +1

    You committed one of the biggest sins in my sql peeves, naming the id. Why the heck would you call your primary key for the people table person_id??? The primary key should either be simply id or include the name of the table, so the people table should have a pk of id, peopleID or people_id. Use of your naming standard should be LAW across all of your tables, so if you use camel case in table names you use camel case in the primary key, ditto for snake case. This way you know the name of the primary key of any table simply by knowing the name of the table if you include it in the pk name, but my tables simply use id as the primary key and any referencing keys to that table use the table name and ID, so join category on category.peopleID = people.id (or people.people_id/people.peopleID if that's your naming standard). Nothing is more frustrating when you're creating joins than everyone using their own standards for keys and referencing keys that tell you nothing. I have tables right now in a system I'm working on where modelID in one table actually points to the signtypeID in a table named signTypes, it's incredibly frustrating since there's no model table or signtype table and therefore doesn't tell me what table the join is for, plus even my own new tables have to point to signtypeID instead of signTypesID so I have to remember what the darned primary key was arbitrarily named or go look it up. The facilityAssets table has a pk named assetID, there is no asset table. DON'T DO IT PEOPLE!

    • @EngineerMan
      @EngineerMan  4 года назад +2

      I agree. I did mean to do people_id. I also like logical and consistent naming. I appreciate the comment.

    • @HadToChangeMyName_YoutubeSucks
      @HadToChangeMyName_YoutubeSucks 4 года назад

      @@EngineerMan -- I thought that was really odd for you to make a mistake like that. We all have our embarrassing moments, I can't count the times I looked at something a second time and said "how long you been doing this and still do that kind of stupid", and I've been doing sql for around 40 years.
      Your use of transactions was great, I seldom see people do that and consider it an absolute must. Few things suck more than telling your boss you just screwed up his data by not triple checking your work. I not only use transactions before updates or deletes, I run select with my constraints first so I can see exactly what will be changed before I change it, and then I still use transactions just in case. If you delete the wrong records and there are cascading triggers recovering can be an incredible headache, especially on a live system that people are currently updating and inserting records into. I further advise to always have a second server with a copy of the live servers last backup you can run any such commands against so if you screw up you do it on data that can be fairly easily restored. Never perform any action that affects live data until you've tested it on non-live data. Bit beyond an introductory to sql, but anyone making a living manipulating someone else's data will be well served to do so since even rolling back transactions can be a problem on live data.

    • @EngineerMan
      @EngineerMan  4 года назад +1

      It's certainly not how I design tables. At first when I was reading your comment I was confused what you were taking exception to. In that moment though I genuinely believed I had done people_id.

    • @HadToChangeMyName_YoutubeSucks
      @HadToChangeMyName_YoutubeSucks 4 года назад

      @@EngineerMan -- As I said I've done goofy things accidentally and later had to chastise myself when I realized what I'd done, it does happen. And believe me, when is see code that makes me say "what the **** were you thinking???" I'm much harder on the offender if it's my code than if it's a workmates code. Thank goodness I don't have potentially 288K people looking over my shoulder correcting me.

  • @jaysonp9426
    @jaysonp9426 Год назад

    You don't capitalize 😳 HEATHEN!

  • @COOKINGBIRD
    @COOKINGBIRD Год назад

    I'm so grateful for the SQL tutorial video. Thank you for sharing your knowledge. 😊📹💾