Hot answers tagged

2

I also completed pset7 recently. You can easily make this query by joining the two tables using the JOIN and ON keywords and with the id as the primary key. The code should be as follows. SELECT title, rating FROM movies JOIN ratings ON id = movie_id WHERE year = 2010 ORDER BY rating DESC, title ASC As for your method, I'm a beginner in SQL and I didn't even ...


2

You are also able to use the INTERSECT keyword. SELECT name FROM people JOIN *tablesyouwanttojoin* WHERE name = "actor number 1" INTERSECT SELECT name FROM people JOIN *tablesyouwanttojoin* WHERE name = "actor number 2" This was the most elegant suggestion I could find online since I had the same problem...


1

Your problem is that you have too many ; in your query. You only place a ; at the very end of your SQL query, not at the end of each SELECT statement. Unless you are performing multiple different, unrelated queries or are coding a procedure/function, you will only have a single ;. So, remove all of those and then see if that works. Also, while I do not do a ...


1

I just recently solved this PSET, so I'm no expert, so I'm going to try and explain what is different about what I did in comparison to what you have (meaning I can't answer the three questions you asked directly). The biggest difference between mine and yours is that I joined the tables, which was important so that I could access the titles and ratings &...


1

Just check your database. I guess the data has been imported 4 times because of which each name has been printed 4 times. There is no real problem with any of your code. Hope this helps you. If it does then please check the tickmark.


1

This with open("characters.csv", "r") is a problem. Why take an argument and not use it? Don't hard code the file name.


Only top voted, non community-wiki answers of a minimum length are eligible