Skip to content

Assignment 2 autorunner fixes #416

@mrpotatocode

Description

@mrpotatocode

Query 12

Request
FYI, for section 3 - UPDATE, the auto runner will flag the answer as wrong if it doesn't include the initial query which was provided to us “ALTER TABLE product_units
ADD current_quantity INT;”
I'm not sure if this is the intended behaviour but it only considered my answer right when I added it (I didn't change anything about the initial query I had itself, just added that before) (edited) 

Fix
Change how the instructions work and add the alter table into the query block

e.g.

-- UPDATE
/* 1.We want to add the current_quantity to the product_units table. 
First, add a new column, current_quantity to the table using the following syntax.

ALTER TABLE product_units
ADD current_quantity INT;

Then, using UPDATE, change the current_quantity equal to the last quantity value from the vendor_inventory details.

HINT: This one is pretty hard. 
First, determine how to get the "last" quantity per product. 
Second, coalesce null values to 0 (if you don't have null values, figure out how to rearrange your query so you do.) 
Third, SET current_quantity = (...your select statement...), remembering that WHERE can only accommodate one column. 
Finally, make sure you have a WHERE statement to update the right row, 
	you'll need to use product_units.product_id to refer to the correct row within the product_units table. 
When you have all of these components, you can run the update statement. */


--QUERY 12
ALTER TABLE product_units
ADD current_quantity INT; 

--write your query here



--END QUERY

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions