CS50 Songs - Lab 7 - Songs Solution 2024. (Beginners Guide)

Поділитися
Вставка
  • Опубліковано 25 січ 2025

КОМЕНТАРІ • 43

  • @RealisticResponse
    @RealisticResponse  Рік тому +5

    Someone posted a comment but I think deleted it but they were absolutely correct. In answers.txt it asks you:
    Spotify Wrapped is a feature presenting Spotify users’ 100 most played songs from the past year. In 2021, Spotify Wrapped calculated an “Audio Aura” for each user, a “reading of [their] two most prominent moods as dictated by [their] top songs and artists of the year.” Suppose Spotify determines an audio aura by looking at the average energy, valence, and danceability of a person’s top 100 songs from the past year. In answers.txt, reflect on the following questions:
    If songs.db contains the top 100 songs of one listener from 2018, how would you characterize their audio aura?
    Hypothesize about why the way you’ve calculated this aura might not be very representative of the listener. What better ways of calculating this aura would you propose?
    Be sure to submit answers.txt along with each of your .sql files!
    So Answers.txt should contain answers to these two questions. For some help you might imagine things like this:
    Discussing audio aura we could look at things like Energy, Danceability, Tempo, and even valence.
    High Energy means possibly more positive
    High Valence Might be uplifting
    High Danceability Might be the same
    low score in these might indicate the opposite.
    HOWEVER, we'd be limited to only the top 100 and that may not indicate the true range or nature of listening and since music changes over time we may not have enough time to see things rise and fall. ADDITIONALLY, and perhaps the biggest thing is personal interpretation. Just because a song is low valence, energy, and danceability, does not mean that the user is not uplifted by such a song.

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

      Bro are these the answers for answer.txt?

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

      @@Nonsense855 users were having trouble understanding how to answer .txt so i wanted to give an example.

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

      @@RealisticResponse yeah and that was so help full for me. Thank you so much

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

      @memories728 my pleasure keep up the good work. Sounds like you're doing great!

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

      @@RealisticResponse Thank you. can I ask you a small thing please. It is about CS50 course. if I won't finish final project before the end of this year, what will happen?

  • @thebass2798
    @thebass2798 Рік тому +3

    Thank you Mr. Devin.

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

      Thanks for your support! Appreciate you! Keep up the good work!

  • @hiitsme5652
    @hiitsme5652 Рік тому +5

    15:11 My name is not "awesome" lol. However, thanks for the help and great video!

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

      lol noted! but appreciate you all the same! Keep up the good work!

  • @katehayes937
    @katehayes937 10 місяців тому +1

    Thank you for explaining in depth!

    • @RealisticResponse
      @RealisticResponse  9 місяців тому

      Thank you for your support! Keep up the great work and happy to help on your journey!

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

    How do i upload all 8 files sql files. I do one at a time and it gives error. Also doesnt let me upload all at once.

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

    Thank you sir.

  • @johnnyfaris7284
    @johnnyfaris7284 11 місяців тому +1

    thanks coach

    • @RealisticResponse
      @RealisticResponse  9 місяців тому

      Rolling right along - you're likely done by now. If so, great work, if not - keep up the good work!

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

    Question 3 is really throwing me off because the way we coded it in this video gives us the right answers but shows the longest song first. Is there a way to reverse this order and still have the top 5 longest songs? The question is the top 5 longest songs in descending order. I would assume that we would need to code it to show the top 5 longest songs, shortest to longest on a table.

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

      You could
      ORDER BY DESC
      I'm on my phone but I assume that would help?

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

    i am having an issue where all that happens when I run the query is the terminal shows --> and I can't clear it or back up to the original terminal sqlite prompt..... help :')

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

      Hey! are you having trouble exiting out of the sql prompt to get back to the terminal? if so, you should type exit or quit and that should get you out of sql

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

      @RealisticResponse none of those commands would work because it was expecting an arguement. I had to reopen a terminal and cd back into the file to restart sql to get rid of the "--->"

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

      @@dt_does4998 i swear I've had this issue before. Shutting down the terminal and reopening is one way but I'm trying to remember if I solved it another way.... I'll have to get back to you if I remember

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

      try ctrl+c

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

    Can you please help me understand exactly what's needed for the answers.txt file . It's been 3 weeks now I'm trying to find the answers

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

      Absolutely. Did you read my pinned comment? It explains that

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

      Wow thanks now I have the idea whats expected

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

      @@bhekidaweti8703 glad to hear it! Keep up the good work!

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

    Thank you i unerstnad this lab better

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

      Happy to help! Week 7 you're almost done keep up the good work!

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

    For Question 7, I have done it this way:
    SELECT AVG(energy) FROM songs
    ...> WHERE EXISTS (
    ...> SELECT *
    ...> FROM artists
    ...> WHERE name = 'Drake'
    ...> );
    +-------------+
    | AVG(energy) |
    +-------------+
    | 0.65906 |
    +-------------+
    Is this wrong? My output is different to the solution.

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

      Close; the EXISTS clause should be used to check if there are any songs by Drake, and it needs to correlate the subquery with the main query to filter only those songs.
      SELECT AVG(energy) AS average_energy
      FROM songs s
      WHERE EXISTS (
      SELECT 1
      FROM artists a
      WHERE a.name = 'Drake'
      AND a.artist_id = s.artist_id
      );
      For a shorter version you could do this:
      SELECT AVG(s.energy) AS average_energy
      FROM songs s
      JOIN artists a ON s.artist_id = a.artist_id
      WHERE a.name = 'Drake';

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

      If these queries return the same value then yours is working but if adding exists (as it should be) changes the return then the one with the exists function should be accurate.

  • @yasir-js
    @yasir-js Рік тому +7

    This one was the easiest I did it on my own, came here only for the answer.txt

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

      HAHAH! think i even messed that part up but i added the pinned comment so i hope it helped! SQL is a fun one for many learners.

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

    I am getting an error while checking ,
    Not an executable object: 'SELECT 1'

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

      hey there. This error message is far to vague for me to help. If you're executing the sql commands properly in sqlite3 then you shouldn't be having this error. BUT - if you're certain things are right you might rm the program and then re-do your wget because i suppose it's possible that the .db file was somehow corrupted.

  • @yasir-js
    @yasir-js Рік тому +1

    Why not write the whole query in one line?

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

      For this one, there are several queries you CAN write on one line given that you put the right operators between tasks. It just isn't on one line because it's typically considered 'cleaner' code to do multiple line. Preference is yours.

  • @minus-infinity
    @minus-infinity Рік тому +2

    i came here for answer.txt i didnt understood what we have to do in there