Search Results
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 |
0
votes
Accepted
Can't access the shares for the portfolio
When you do a query, it returns the result set to the variable as rows. Even if it's just one value in one row, you need to extract the data.
$rows = query("SELECT symbol, shares FROM portfoli …
1
vote
Accepted
Finance, problem with database
A select statement can always potentially return multiple results, either expected, or because there may be a problem with the data (corrupt database, entry error, etc.), so the process always returns …
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 …
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 …
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 …
1
vote
Can't display name of stock PSET7
It looks like stock is the symbol for the stock in the database, and it is being assigned to both the name and symbol.
for purchase in purchases:
stock = purchase["stock"]
...
purchase['s …
1
vote
Accepted
History, Timezones and Daylight Saving Time
All very good questions and observations. Kudos for thinking about them all. In the real world, this would be very critical.
However, this is an implementation of a stock trading website - a simulat …
0
votes
When stock and user exist, update (PSET8)
SQL code is a bit different from programming language syntax. Here's a template to give you an idea how to do what you want. You'll have to change the appropriate vars and values for your needs. ;- …
0
votes
Accepted
How do I select a specific part of the database
You're selecting ROWS from a database table, not columns. In short, you're selecting every row from a given table where the value of the column is equal to the given value.
Or, in other words, you'r …
0
votes
Update portfolio on duplicate id and stock
The code would need to do a select on the table to find out how many shares are owned and then update the value. In this method, you need to do a SELECT from the table to find out if the user owns the …
0
votes
How to tell if selling shares results in a negative amount pset8
Shot in the dark:
if dbshares[0]['shares'] - shares < 0:
The precedence order has "<" over "-". That means that "shares < 0" is being evaluated first. Maybe try adding parentheses?
if (dbshares …
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 …
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 …
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 …
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 …