You are not logged in Log in Join
You are here: Home » Members » MJ's corner on Zope » QuantumPythons » Question11 » wikipage_view

Log in
Name

Password

 
 
FrontPage »

Question11

Question 11

Update the quantity for p06 and p07 to 90000. Now write a query that will return the pid and pname for all PRODUCTS whose quantity on hand is less than the reorder number. The column title should be: PID NAME Percent Of Reorder where this column is the QUANTITY divided by REORDER. Arrange the output in ascending order by pname.

SQL:

    update product
        set quantity = 90000
        where pid in ('p06', 'p07');

    select pid, pname, (DOUBLE(quantity)/DOUBLE(reorder)) as "Percent Of Reorder"
        from product
        where quantity < reorder
        order by pname;

Output:

    p07 case    0.9
    p06 folder  0.9


mj (Sep 17, 2001 8:09 pm; Comment #1)
Last one I'll do.