Hot answers tagged

3 votes
Accepted

SQL3 SUM troubles

You can't use the aggregated value in WHERE. WHERE is applied to the table data, and the aggregated values are created later. There is the complementary HAVING clause, processed after aggregation. ...
Blauelf's user avatar
  • 20.9k
2 votes
Accepted

How do we delete existing flight in sqlite via Django?

I was having the same problem. What worked for me was going back into Django shell and entering the following command. Flight.objects.filter(id=1).delete() Of course if there is more than one flight ...
Damian Danner's user avatar
2 votes

Lab9 -- Buttons to delete DB entries don't work

One problem is the html sends person.id as a list ( value="{{ [person.id] }}) so it will never find a match in the db. Once that is fixed another problem will be discovered: it will not add ...
DinoCoderSaurus's user avatar
1 vote
Accepted

CS50 Problem set 9 - Finance - RuntimeError: foreign key mismatch - "holdings" referencing "users"

First question: Did you confirm that the userid in the insert statement for the row you're trying to insert into the holdings table actually exists in the userid table? If not, you get a runtime ...
Cliff B's user avatar
  • 68.4k
1 vote
Accepted

PSET9 FINANCE SQLITE "no such column exists" while multiplying two columns to update a third

SQLite (or any other flavor of SQL) does not allow using column aliases in the same SELECT query.
DinoCoderSaurus's user avatar
1 vote

CS50 PSET7 Movies "query did not return results" 12.sql

Consider the potential problems that might result from hardcoding an id and running the query on a different database. Hint: you know the name of the person to look for.
DinoCoderSaurus's user avatar
1 vote
Accepted

Finance Buy function: Error when trying to create shares table, 'unknown column "user_id" in foreign key definition'

Without seeing the description of the table where you're trying to add the foreign key, my best guess is this. FOREIGN KEY(fk_user_id) requires that the parameter here must be a column in the child ...
Cliff B's user avatar
  • 68.4k
1 vote
Accepted

Finance Pset, SQL DB, db.execute troubles

The flask error log (in the console where flask run) should give you all the info you need to troubleshoot and debug. Problem with the first (hover to see spoiler): Problem with the second:
DinoCoderSaurus's user avatar

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