Link to home
Start Free TrialLog in
Avatar of rwill357
rwill357

asked on

SQL Question

I'm having trouble with this quetion can anyone help me undestand how to come to come to the answer.

Add a field named Allocation to the Part table. The allocation is a number representing the number of units of each part that have been allocated to each customer. Set all values of allocation to zero. Calculate the number of units of part number KV29 currently on order. Change the value of allocation for part number KV29to this number. Display all the data in the Part table.

ALTER TABLE Part
ADD Allocation CHAR (0)
UPDATE Part
SET Allocation= some number
WHERE PartNum= some number
;
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Correction to the last update:
UPDATE Part
SET Allocation = (SELECT COUNT(1) FROM [allocation_table] WHERE part_number = 'KV29')
WHERE PartNum = 'KV29';

Open in new window

You can define a CHAR(0) but such a field can only store an empty string or NULL. Which does not appear to suit the requirement you describe.