How To Solve SQL Problems

Поделиться
HTML-код
  • Опубликовано: 21 ноя 2024

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

  • @RameenFallschirmjager
    @RameenFallschirmjager 4 года назад +111

    Real heroes are not those who go to wars or pick a fight or engage in any destructive activity. Real heroes are those who make, build, create and educate. These men and women make world a better place. Our culture should reinvent itself. We need to reconfigure our culture in a way that movies and books and comic books depict this kind of heroism. Kyle, you are a real hero. I appreciate your great work and I hope you prosper. People like you deserve to be powerful and rich, because you contribute to others' well being with your power.

    • @WebDevSimplified
      @WebDevSimplified  4 года назад +14

      Thank you so much!

    • @Mykyta_Palamarchuk
      @Mykyta_Palamarchuk 2 месяца назад +3

      I am not gonna argue that people that create and give back are heroes, but as a person who lives in a country that is being torn apart by another rotten country - I am sure thankful for heroes who fight in inhumane conditions to protect their home and our existence.

  • @wandersonhelmer1810
    @wandersonhelmer1810 2 года назад +16

    I have just finished your exercises and came by to take a peek whether or not I was in the right direction. Sure enough I did a pretty decent job thanks to your teaching. I cannot express how much I very much appreciate your job here on youtube. Thank you ever so much and I hope your channel grow atomically!

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

    In the repo You have a misspel in the column name: instead of "length" it is "lenght"
    Thx for the 60 min intro and for the exercises!
    You have much more structured lecture and easily percieved speach than other SQL teachers on youtube

  • @remccs16
    @remccs16 2 года назад +3

    Thanks Kyle! Watching this after working through the problems on my own helped solidify SQL foundations. Thank you for all your hard work!

  • @edimathomas-cr4km
    @edimathomas-cr4km Год назад +2

    This was incredible. As a beginner, some of the exercises were tough but I'm glad I completed all the exercises. Surprisingly, 12 was among the easiest for me.

  • @saisameerlolla5474
    @saisameerlolla5474 2 года назад +2

    The SQL series is awesome. Just watched it to get a quick refresh of MySQL, and really feeling confident in it now. Thanks Kyle!

  • @kunalpandey7189
    @kunalpandey7189 3 года назад +7

    3rd question can be done simply by--
    select min(release_year) from albums

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

      kindly provide the answer to that.
      same output

  • @senaakpalamut2423
    @senaakpalamut2423 11 месяцев назад

    learning anything is possible with a great teacher, i ahve been trying to understand the structure of the SQL programming until i watched your 60mins video and now i am able to solve all the questions that you explain here. thank you very much, great work, great quality!

  • @roshanshah5831
    @roshanshah5831 3 года назад +15

    Hello this one was really good, Could you make some more of SQL stuff on your channel which focuses on advanced concepts or practise?

  • @alaaalsherbini5146
    @alaaalsherbini5146 Год назад +1

    Off topic but great taste in music

  • @sanjitselvan5348
    @sanjitselvan5348 Год назад +2

    You sir, are gonna go lengths! Thank you and all the very best!

  • @hadireg
    @hadireg 5 лет назад +1

    using sql every day, you picked here some nice examples to start off! 👍😉

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

    You are 10/10 explaining SQL and breaking it down pretty well. This however, is really not complicated at least "solving a problem", unrealistic example by all means wish you would do more to explain the in depth 3 table inner join, with nested queries etc

  • @metehansert647
    @metehansert647 2 года назад +2

    Nice tutorial, teached me a lot of good songs.

  • @pulseshortsvideosforyou
    @pulseshortsvideosforyou 8 месяцев назад

    What an amazing video. It was really helpful to learn and understand the SQL queries. Thank you so much for this.

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

    Just as a side thought, I would think that the better-optimized query would be using WHERE instead of HAVING to define the filter. Because where would take just a limited number of records, and having would consider all of them, so it would be significantly faster. wouldn't it? Again, it is just an opinion :)

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

    Loved these questions! Can you make a new video on how to write optimized queries?

  • @nicholasnorman9591
    @nicholasnorman9591 3 года назад +2

    Looks like many of us are having some issues with #5. Can anyone help me understand why the COUNT(albums.id) doesn't read COUNT(albums.band_id)?? It makes more sense to me and returns the same result...? Way to go everyone. Keep it up!

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

    I can't believe this is free! Thank you so much!

  • @bob-zl5nq
    @bob-zl5nq 7 месяцев назад

    Thang you so much❤❤❤ you've just saved my midterm😊

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

    Your tuts are the best on YT

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

    This was incredibly helpful and awesome, thank you Kyle!

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

    Super sir..i am beginner.. please provide any pdfs of SQL .to learn

  • @yurii8710
    @yurii8710 5 лет назад +1

    Thanks for the lessons!
    I've done all exercises, except 3 and 5))

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

    Can't appreciate this more, thanks a lot SQL hero!

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

    Is it normal to group by a column that is not specified in the select statement?
    I saw that here 7:13 at line 4. also at 10:31 at line 7

  • @infamismworldwild6248
    @infamismworldwild6248 6 месяцев назад

    Thank you so much, this was really beneficial

  • @zakariabenlkbir6878
    @zakariabenlkbir6878 3 года назад +2

    Hi, i'm asking for the auto_increment statement ! Are we can replace it with the identity statement ??

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

    oh my gosh your channel is so amazing

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

    I solved #12 using nested queries and noticed that your answer does not display that band "Dream Theater" because they have no songs. I believe this is because your joins are left joins and not outer joins

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

      A left join is an outer join, aka left outer join.
      He uses inner joins. That's why. A simple (just) join is an inner join. At least in MySQL...
      If he also had a where clause, sometimes the where clause can turn a left join into an inner join. I don't he would ever cover an issue like that...

  • @nobody008eermac949
    @nobody008eermac949 5 лет назад

    For Problem 7:
    SELECT * FROM albums
    WHERE release_year IS NULL;
    UPDATE albums
    SET release_year =1986
    WHERE id =4;
    You used UPDATE specifically for where the key was id=4, but what if we had a larger data set and we wanted multiple id's. Like id=4, id =10, id=38, id=50. Is there a way in which we could find these id's without manually searching for them and manually putting in id values to update.
    Thank you for these videos! They are very clear and helpful!

    • @WebDevSimplified
      @WebDevSimplified  5 лет назад

      You can use anything in the where section of your update. For example if you wanted to update all albums with a release_year of 2000 you could say WHERE release_year = 2000

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

      I think it is possible to update many rows at once but only it one fixed year. Like all of them to have release_year = 1986.
      If you want however to have release_year = 1989 for id 4 and release_year=1999 for id 10 ... etc. then I do not think it would be possible other than manually.

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

    What a great lesson! Thanks!

  • @2herzog
    @2herzog Год назад +1

    i cant solve those tasks based on the tutorial you provided, sure i can google similar cases and copy, this is so frustrating

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

    I have a problem for you to solve.
    Let's say you have a temp table with 2 million records that contains some fields. One of the fields contains one of a couple dozen formulas as a string. The couple dozen formulas all occur in some of the 2 million records... The formulas references other fields in your table and might also use a multiplier. I.e. "HrsPerDay*1", "HrsPerDay*1.25", "HrsPerDay*1.5", HrsPerWeek/5*1.25*fte", etc.. There is also a field that has to be calculated that holds the formula's result. How do you do this?
    The formulas need to be evaluated as quickly as possible. In less than a minute. 10 seconds would be good...

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

    You are absolutely incredible. Thank you

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

    Thank you

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

    Hi sir
    Your video is useful for
    Please c language codeing tell me sir

  • @vickia.9641
    @vickia.9641 Год назад

    Mr. @kyle, please create a training for HAR file training to be analyzed. Thanks in advance...

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

    Well, trying to learn this stuff is just a heavy blow on my self-esteem and constantly being reminded that I'm not very quick at learning

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

      good vids though

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

      @@DDismas Patience is key. One year ago, I was terrible at everything but right now I am getting things better. Still have lots of work to do but I can see my progress. Don't worry man and keep on learning!

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

      I am more than 10 years in programming and have positioned myself between 6 or 7 on the 0 to 10 scale. It is based on infinite number of problems I have researched and while I learn, try and find the solution I also see how other guys understand it
      But I still have most of my days feeling bad about my speed of work at my work place.
      Philosophers say it is number one virtue of sanity to question yourself and doubt yourself.

  • @DrengrByHeart
    @DrengrByHeart Год назад +1

    Why do you use periods when you are already specifying where the column comes from? I don't understand why and how to use it really...

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

    thank you so much for this!

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

    loved the way you explain that! thanks a lot ;)

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

      Ohhh “ ;) “ , she tryna flirt with you bro

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

    How do we save data from API calls to our DB? make a practical video showing how JS + SQL work and link between backend and front end, you can do a short simple one not 1h project example. Do it with a web component if you're a god

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

    for the 3rd query can't we just write it as SELECT * FRFOM ALBUMS WHERE RELEASE_YEAR=MIN(RELEASE_YEAR);

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

    Master brenches are called Main branches for a good reason

  • @AlejandroGonzalez-sw7jz
    @AlejandroGonzalez-sw7jz Год назад +5

    Hi, I get this error in exercise 5, even when I use the solution code, did anyone get the same?
    Error Code: 1055. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'record_company.bands.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

    • @bitetheapple8
      @bitetheapple8 Год назад +7

      I had the same error & then changed the group by and it worked
      SELECT b.name AS 'Band Name'
      FROM bands AS b
      LEFT JOIN albums AS a ON b.id = a.band_id
      GROUP BY b.id
      HAVING COUNT(a.id) = 0;

    • @parsaf3856
      @parsaf3856 Год назад +5

      @@bitetheapple8 I had the same error. Thanks for the solution. I also used a different query.
      SELECT b.name AS 'Band Name'
      FROM bands AS b
      LEFT JOIN albums AS a
      ON b.id = a.band_id
      WHERE a.band_id IS NULL;

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

      @bitetheapple8 Perfect. Thank you for sharing 👍😁

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

    Hello, I am new to this so this might be a naive question but can we solve ques-3 by using the 'Having' clause?

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

    thanks sir !

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

    Nice thanks ❤

  • @abhaykumarsharma7050
    @abhaykumarsharma7050 Месяц назад

    I post it from command line

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

    am i the only one getting 'Error while executing SQL query on database 'album': near "AUTO_INCREMENT":'?

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

      You're probably using a different SQL, try using "IDENTITY (1, 1)" instead of that

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

    “Let my DBA have a look at my query”
    Usually he gets so frustrated he does it with me on the spot.
    Now a year later im the persons newbies ask for help with SQL queries.

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

    is there a problem here requiring analytic not practice how to input and where to etc. Like real world problem

  • @loveforever5687
    @loveforever5687 Год назад +1

    help, my mySQL is being stupid. I copied and paste your codes into mysql and it wont run it for some reason.

  • @kwamedaniels1888
    @kwamedaniels1888 5 месяцев назад

    Please send me the link to the questions

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

    Is it in SQL servwr or in my SQL ?

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

    in the last question can we group by band.name

  • @rycka01
    @rycka01 5 лет назад

    Hey, Kyle. In #5, in the GROUP BY albums.band_id line, is the 'albums.' part necessary? It seems to work without it.

    • @WebDevSimplified
      @WebDevSimplified  5 лет назад +2

      It will work without it. The only time you need the table name before the column is if two tables in your query have a column with the same name.

    • @rycka01
      @rycka01 5 лет назад

      @@WebDevSimplified Gotcha

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

    Hey Followed all the instructions but its not letting me create the songs table, giving me an error code 1063 : incorrect column specifier for column 'name'

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

    Failed to execute SQL script statement of class path resource
    Why and when its come
    Please answer this ..

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

    for question 11, I got an error when I also selected column songs.name. Is there a reason for that? Thanks for any opinions

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

    In the exercise 11, his returning the longest song duration for each album, without decimal places, wich means, his auto rounding the values and i don´t know why ?
    Can someone give me a tip why ?
    The Query is 100% rigth btw

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

    14:21 can we use "drop" instead of delete?

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

      DROP in SQL means that entire table will be dropped (the table will not exist after this command) with all data in it. And there is no "Are you sure ..." :)
      Read about SQL TRUNCATE vs DELETE vs DROP.

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

    I think in Oracle 'Group by ' doesn't work like in MySQL. Solution 4, 5, 6 doesn't work.

  • @rodioniskhakov905
    @rodioniskhakov905 Год назад +2

    Very hard to understand for a complete beginner😥

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

      Check out alex the analyst on RUclips.

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

    In 11th question select longest song of each album. how can we display name of that longest song also.

  • @solomongbadebo379
    @solomongbadebo379 Год назад +4

    Wanted to comment, on problem #5. Idk if the system was updated or different keywords were used, but the function didn't go through and it gave me an error.
    However I read through it and changed the 'GROUP BY' command to 'bands.name' instead of 'albums.band.id' which made the query look like this:
    SELECT bands.name AS 'Band Name'
    FROM bands
    LEFT JOIN albums ON bands.id = albums.band_id
    GROUP BY bands.name
    HAVING COUNT(albums.id) = 0;
    Just in case if anyone else had problems like I did.

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

    at 10:27 whats the difference between doing AS Name and AS 'Name'?

    • @wendyduvall1000
      @wendyduvall1000 3 месяца назад

      I think the quotes are only necessary if the alias contains a space

  • @samuelkitur263
    @samuelkitur263 11 месяцев назад

    The video is good and educational but the lecture is very fast when lecturing.

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

    Why there is no table representation? All the way through the video till the last minute i realised there are 3 tables instead of 2

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

    value otherwise is not a member of org.apache.spark.sql.dataframe
    Please give me the correct answer

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

    I have a problemin my charging patient table .the data insert in the table through 8 forms.....the sequence which is define for this table jumped ..and escape the values...the structure of the sequence having min 1 and mix 10 lakh with nocash .. so the problem is that the sequence is jump ..it miss values in the table...whts should be do??? How to fix this problem ???.. i think the problem is in the forms where data is inserted in the table ... Any one help to fix my problem???

  • @danieltornero5523
    @danieltornero5523 5 лет назад

    In exercise #6 when you return the album name as Name (albums.name AS Name) shouldn't Name has apostrophe since it's a VARCHAR variable?

    • @michak4188
      @michak4188 3 года назад +1

      If the alias has only one word apostrophes are not needed

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

      AS Something means that you are giving that column other name than its original name. In this case its original name is name with small letters. On the output however it will appear as Name with cap N. It has nothing to do with the value type of the column.
      You would need apostrophe if more than one word is used for renaming or the word used is somewhat reserved by he SQL syntax . In that same example it puzzles me though why Kyle uses apostrophe for Duration.

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

      @@mocococo2877 hey, man , thanks for the huge help for those of us who asked in comments, appreciate
      do u have a discord or skype?

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

    Couldn't solve 5, 7 and 12

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

    For 7th problem,
    Can someone verify this:
    Update albums
    Set releaseyr = 1986
    where id in {
    Select id from albums where releaseyr is null
    } ;

    • @Unknown-840
      @Unknown-840 2 года назад

      it works but it's not ideal, your filtering through the table twice
      you should do it like this:
      Update albums
      Set releaseyr = 1986
      where releaseyr is null;

  • @vardhanabhi5503
    @vardhanabhi5503 3 года назад +1

    900 th like "Me" 😁😁

  • @abhaykumarsharma7050
    @abhaykumarsharma7050 Месяц назад

    I solve

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

    I will give one simple problem can you solve

  • @GauriSuralkar-sz3zn
    @GauriSuralkar-sz3zn Год назад

    I did it! ^_^ Imsh

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

    On Excercise 6 I get this error even when I copy & paste your solution: "17:25:08 SELECT albums.name as Name, albums.release_year as 'Release Year', SUM(songs.length) as 'Duration' FROM albums JOIN songs on albums.id = songs.album_id GROUP BY songs.album_id ORDER BY Duration DESC LIMIT 1 Error Code: 1054. Unknown column 'songs.length' in 'field list' 0.000 sec:

  • @LogicalPrime
    @LogicalPrime 7 дней назад

    I was able to do #5 and get the same result with the following query:
    SELECT bands.name as 'Band Name' FROM albums
    RIGHT JOIN bands ON albums.band_id = bands.id
    WHERE albums.name is NULL;
    However when I try the answer provided in this video as below I'm getting an Error code 1055:
    SELECT bands.name AS 'Band Name'
    FROM bands
    LEFT JOIN albums on bands.id = albums.band_id
    GROUP BY albums.band_id
    HAVING COUNT(albums.id) = 0;
    Would anyone be able to help explain what I may be overlooking?