I'm trying to write a buy() function which would update user's stocks and his balance.

I've added two new tables to my finance.db: stocks table for storing user's stocks and transactions table for storing user's transaction history. The whole schema looks like this: schema creation db schema

Now the issue is that i cannot insert into my new tables from within cs50's SQL module in any way. It always shows the same error message no such table: main.user as depicted below: error message

It is not something about SQL-specific syntax and the way I created and queried my new tables since I am able to run the same INSERT queries against my tables directly in sqlite and they work just fine

It is clearly not something about the server not being able operate with my new tables because with all other operation (e.g. SELECT, UPDATE, DELETE) it works just fine

It is something about my new tables though, as I am able to run INSERT queries against initially defined users table, but not against my new tables

1 Answer 1


schema does not, in fact, have a table named user. Typo in the create statements.

  • Thank you so much, it really helped! Oct 14, 2023 at 7:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .