1

I am having an issue when inserting a symbol more than once into the portfolio table.

I followed pset7 directions making both user_id and symbol as unique:

A neat way to impose this restriction after creating your table is to add a "joint key." After saving your table, click phpMyAdmin’s Structure tab for the table, then check both user_id and symbol, then click Unique to the right of With selected

ALTER TABLE  `portfolios` ADD UNIQUE (`user_id` , `symbol` );

but I get the error if for example, another user has GOOG stock. It should only crash if the combination "user_id and symbol" is in the table, but not if only symbol is in the table.

phpMyAdmin error

Thanks!!

1

OK... looks like there is a quick fix this that it was not implicit in the description. By adding ALTER TABLE yourtablename ADD CONSTRAINT uq_yourtablename UNIQUE(column1, column2); it seems that the problem is solved, this initially should do the trick. :-)

You must log in to answer this question.

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