How To Solve SQL Problems

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ม.ค. 2025

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

  • @RameenFallschirmjager
    @RameenFallschirmjager 5 ปีที่แล้ว +115

    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  5 ปีที่แล้ว +15

      Thank you so much!

    • @Mykyta_Palamarchuk
      @Mykyta_Palamarchuk 4 หลายเดือนก่อน +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!

  • @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!

  • @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.

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

    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!

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

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

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

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

  • @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

  • @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?

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

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

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

      kindly provide the answer to that.
      same output

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

    Nice tutorial, teached me a lot of good songs.

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

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

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

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

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

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

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

    This was incredibly helpful and awesome, thank you Kyle!

  • @xawerywisniowiecki133
    @xawerywisniowiecki133 4 ปีที่แล้ว

    Your tuts are the best on YT

  • @bob-zl5nq
    @bob-zl5nq 9 หลายเดือนก่อน

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

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

    Off topic but great taste in music

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

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

  • @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

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

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

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

    What a great lesson! Thanks!

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

    oh my gosh your channel is so amazing

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

    Thank you so much, this was really beneficial

  • @neonfuschia
    @neonfuschia 4 ปีที่แล้ว

    You are absolutely incredible. Thank you

  • @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!

  • @surajshivakumar5124
    @surajshivakumar5124 4 ปีที่แล้ว

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

  • @asselbuzheyeva4740
    @asselbuzheyeva4740 4 ปีที่แล้ว

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

    • @fitfirst4468
      @fitfirst4468 4 ปีที่แล้ว

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

  • @NadimM__
    @NadimM__ 2 ปีที่แล้ว

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

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

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

  • @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...

  • @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 :)

  • @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.

  • @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'

  • @franciscrypto9143
    @franciscrypto9143 2 ปีที่แล้ว

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

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

    thank you so much for this!

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

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

  • @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

  • @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

  • @marchingfeet
    @marchingfeet 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?

  • @marutlagovindu9427
    @marutlagovindu9427 3 ปีที่แล้ว

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

  • @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

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

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

  • @harshitgupta9593
    @harshitgupta9593 3 ปีที่แล้ว

    in the last question can we group by band.name

  • @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 👍😁

  • @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

  • @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...

  • @dudytot4450
    @dudytot4450 4 ปีที่แล้ว

    Nice thanks ❤

  • @vickia.9641
    @vickia.9641 ปีที่แล้ว

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

  • @manishamorya24
    @manishamorya24 4 ปีที่แล้ว

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

  • @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???

  • @darshanpagar1894
    @darshanpagar1894 2 ปีที่แล้ว

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

  • @ayaka1255
    @ayaka1255 2 ปีที่แล้ว

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

  • @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

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

    Is it in SQL servwr or in my SQL ?

  • @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?

  • @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.

  • @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

  • @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...

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

    Please send me the link to the questions

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

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

  • @manishamorya24
    @manishamorya24 4 ปีที่แล้ว

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

  • @johanneskingma
    @johanneskingma 3 ปีที่แล้ว

    Master brenches are called Main branches for a good reason

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

    900 th like "Me" 😁😁

  • @mohseenmohammed46
    @mohseenmohammed46 2 ปีที่แล้ว

    thanks sir !

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

    Thank you

  • @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

  • @DeltaNrOne
    @DeltaNrOne 2 ปีที่แล้ว

    “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.

  • @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;

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

    I've confused this vdo with learn sql in 60 minutes part 2, it's definitely not...is it??

  • @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.

  • @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:

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

    Very hard to understand for a complete beginner😥

    • @davidn9391
      @davidn9391 2 ปีที่แล้ว

      Check out alex the analyst on TH-cam.

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

    Couldn't solve 5, 7 and 12

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

    I post it from command line

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

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

  • @Suni777
    @Suni777 3 ปีที่แล้ว

    I will give one simple problem can you solve

  • @GauriSuralkar-sz3zn
    @GauriSuralkar-sz3zn ปีที่แล้ว

    I did it! ^_^ Imsh

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

    I solve

  • @solomongbadebo379
    @solomongbadebo379 2 ปีที่แล้ว +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.

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

      Thank you for this

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

      thanks, i was confused by answer on githab

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

    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?