Skip to content

Instantly share code, notes, and snippets.

@moqdm
Created September 6, 2021 13:22
Show Gist options
  • Select an option

  • Save moqdm/6d19f02b52c425ef38451afa64f660f4 to your computer and use it in GitHub Desktop.

Select an option

Save moqdm/6d19f02b52c425ef38451afa64f660f4 to your computer and use it in GitHub Desktop.
it's my Lab 7: Songs solution... *Please just take a look if you couldn't solve it ... Thank you πŸ™‚ #cs50
-- 1.sql
SELECT name FROM songs;
-- 2.sql
SELECT name FROM songs ORDER BY tempo;
-- 3.sql
SELECT name FROM songs ORDER BY duration_ms DESC LIMIT 5;
-- 4.sql
SELECT name FROM songs WHERE danceability > 0.75 AND energy > 0.75 AND valence > 0.75;
-- 5.sql
SELECT avg(energy) FROM songs;
-- 6.sql
SELECT name FROM songs WHERE artist_id = (SELECT id FROM artists WHERE name == "Post Malone");
-- 7.sql
SELECT avg(energy) FROM songs WHERE artist_id = (SELECT id FROM artists WHERE name == "Drake");
-- 8.sql
SELECT name FROM songs WHERE name LIKE "%feat.%";
@cupSonic45

Copy link
Copy Markdown

Thanks this really helped me

@amaan-p

amaan-p commented Jun 3, 2022

Copy link
Copy Markdown

you can just put SELECT name FROM songs WHERE artist_id = (SELECT id FROM artists WHERE name = "Post Malone");
since single "=" sign in SQL indicates equality as there is no concept of assignment in this language

@khushiya26

Copy link
Copy Markdown

I got an error like Error when executing query: Not an executable object: 'SELECT 1'. what to do?

@Ali2Elbareg

Copy link
Copy Markdown

What's the solution of answer.txt

@husseinhazemsary

Copy link
Copy Markdown

fhgdhh

@husseinhazemsary

Copy link
Copy Markdown

i ran q 5 and it gave me a syntax error

@Manish-Kumar467

Copy link
Copy Markdown

i ran q 5 and it gave me a syntax error

TRY writing AVG( ) instead of avg( )

@Habboub18

Copy link
Copy Markdown

What's the solution of answer.txt

I couldn't find it, Can you help me?

@Akanshasingh001

Copy link
Copy Markdown

where to write all these solutions

@sajjadahmadi4

Copy link
Copy Markdown

WHat to put in answers.txt?

Read the instructions, before the Testing section, there is another section (Spotify Wrapped) in that section there are two questions, you must answer those question in your answers.txt file.

@IshanKothapalli

Copy link
Copy Markdown

Answers.txt is literally just reflection questions, read the instructions -_-

@edithlobato

Copy link
Copy Markdown

someone can help me solving this problem set? please +52 5518382237

@Akshaya1357

Copy link
Copy Markdown

Thank you so much. It helped me alot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment