Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 4847
1 vote
Accepted

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

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 erro …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

CS50 Finance: Can't add time of transaction

I think you've conflated two different concepts here. First, understand that ALTER TABLE changes the entire table,not just a single row. Don't use that to update an individual record. Next, you can ad …
Cliff B's user avatar
  • 69.3k
2 votes
Accepted

CS50 Finance ValueError: FOREIGN KEY constraint failed

A foreign key constraint fail usually means that the code is trying to insert something into table b with data that requires a field that must already exist in table a. In this case, I'd say that th …
Cliff B's user avatar
  • 69.3k
0 votes

Finance - Index showing correct number of rows but all the same record. For- loop issue?

I'm thinking that there's a flaw elsewhere in your code that's causing the same data to be inserted/updated in the database so that all rows that meet the select criteria are being changed to ALL the …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

FINANCE: GROUP BY doesn't add up the numbers of shares of the same stock

BY doing "GROUP BY symbol, shares", it will do exactly that - any rows of AAPL, 4 shares will be grouped together, and any AAPL, 3 shares will be in a separate grouping. try "GROUP BY userid, symbol" …
Cliff B's user avatar
  • 69.3k
1 vote

PSET8 Finance Buy. SQL query not executing

Did you test the query directly on the database? My gut says that the "/" in the buy/sell column name is causing problems. Try changing the column name in the table to something without any special ch …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Finance sql doubt

Sure. Use the UPDATE sql command, It'll take the form of "UPDATE table SET some value WHERE some_condition". Google sql update For example: UPDATE users SET firstname = "Fred", lastname = "Derf" WH …
Cliff B's user avatar
  • 69.3k
0 votes

Finance Register Checking for Duplicate Username Not Working

This is usually an issue with the database itself and not with the code. When you created the table, did you create either a primary or unique key on the username column? This is what prevents dupli …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

Pset8 Finance stocks typed in lower case don't appear in portfolio

how about toupper(in c) or upper(python)? Best practice is to convert every symbol to uppercase before putting it into a table and before trying to do a search on a symbol. BTW, isupper only check …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

Does every SQL table need a primary key?

Yes, you are wrong. But it's not an unreasonable assumption. A Primary Key is literally the primary restriction on data of a table. It puts restrictions on duplicate data on the table. But there's …
Cliff B's user avatar
  • 69.3k
0 votes

:( buy handles valid purchase Pset7 Why is this such a problem

Well, if I had to guess, I'd say there's a problem with your per share price. check50 reports that it's looking for 112.00 but your screen shot is showing 133.77. Where are you getting your per shar …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

unused variable error when trying to create separate table for each user's transactions in f...

Can't speak to the user error because I'm not well versed in flask, other than to say that an unused variable is pretty much self-explanatory. But, hopefully, this explanation will make the whole thi …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Why won't DELETE * FROM in sql work? i Guess I could delete each column individually. Furthe...

Before I answer, here's a pillow for your forehead so that you don't hurt yourself when you slap it! ;-) It's DELETE FROM, not DELETE * FROM. Just remove the *. And, no, deleting each column indiv …
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

PSET8 Finance - Foreign key mismatch - "portfolio" referencing "users"

Asked and answered in comments. If this answers your question, please click on the check mark to accept. Otherwise, it'll sit in the unanswered question pool forever. Let's keep up on forum mainten …
Cliff B's user avatar
  • 69.3k
0 votes
Accepted

When displaying price in index.html if there are 2 shares,

Asked and answered in comments. If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-) Can you clarify what you mean by "What if price if …
Cliff B's user avatar
  • 69.3k

15 30 50 per page