Question: Challenge #1 - Part 4 Task Now that you have the discount_pct, use your code from that calculation and multiply it by the original_price to
Challenge #1 - Part 4 Task Now that you have the discount_pct, use your code from that calculation and multiply it by the original_price to see if it matches the discount_amount you calculated . Again, do this calculation in a new column and name the column check. Want a hint? For this new column, use the same code that you used for the last column, but multiply it by the original_price field. Remember, you cannot reference a column name (like discount_amount) within the same query, so you will have to copy the calculation you used previously. Be careful of parentheses! 4/5 567843 AS discount_pct from retail.products Where current_price < original_price product_id sku original_price current_price on_markdown discount_amount discount_pct 67 SC-BLK-8 2
Now that you have the discount_pct, use your code from that calculation and multiply it by the original_price to see if it matches the discount_amount you calculated . Again, do this calculation in a new column and name the column check.
I need step-by-step instructions to know how to add the new column check as asked in Challenge #1 - part 4.
- SQL Viewer
| product_id | sku | original_price | current_price | on_markdown | discount_amount | discount_pct |
|---|---|---|---|---|---|---|
| 67 | SC-BLK-8 | 250 | 200 | 1 | f | 0.20 |
| 68 | SC-BLK-8.5 | 250 | 200 | 1 | f | 0.20 |
| 69 | SC-BLK-9 | 250 | 200 | 1 | f | 0.20 |
| 70 | SC-BLK-9.5 | 250 | 200 | 1 | f | 0.20 |
| 71 | SC-BLK-10 | 250 | 200 | 1 | f | 0.20 |
| 72 | SC-BLK-10.5 | 250 | 200 | 1 | f | 0.20 |
| 73 | SC-BLK-11 | 250 | 200 | 1 | f | 0.20 |
| 74 | SC-BLK-11.5 | 250 | 200 | 1 | f | 0.20 |
| 75 | SC-BLK-12 | 250 | 200 | 1 | f | 0.20 |
| 76 | SC-BLK-12.5 | 250 | 200 | 1 | f | 0.20 |
| 77 | SC-BLK-13 | 250 | 200 | 1 | f | 0.20 |
| 78 | SC-BRN-8 | 250 | 200 | 1 | f | 0.20 |
| 79 | SC-BRN-8.5 | 250 | 200 | 1 | f | 0.20 |
| 80 | SC-BRN-9 | 250 | 200 | 1 | f | 0.20 |
| 81 | SC-BRN-9.5 | 250 | 200 | 1 | f | 0.20 |
| 82 | SC-BRN-10 | 250 | 200 | 1 | f | 0.20 |
| 83 | SC-BRN-10.5 | 250 | 200 | 1 | f | 0.20 |
| 84 | SC-BRN-11 | 250 | 200 | 1 | f | 0.20 |
| 85 | SC-BRN-11.5 | 250 | 200 | 1 | f | 0.20 |
| 86 | SC-BRN-12 | 250 | 200 | 1 | f | 0.20 |
| 87 | SC-BRN-12.5 | 250 | 200 | 1 | f | 0.20 |
| 88 | SC-BRN-13 | 250 | 200 | 1 | f | 0.20 |
| 89 | SC-BLU-8 | 250 | 200 | 1 | f | 0.20 |
| 90 | SC-BLU-8.5 | 250 | 200 | 1 | f | 0.20 |
| 91 | SC-BLU-9 | 250 | 200 | 1 | f | 0.20 |
| 92 | SC-BLU-9.5 | 250 | 200 | 1 | f | 0.20 |
| 93 | SC-BLU-10 | 250 | 200 | 1 | f | 0.20 |
| 94 | SC-BLU-10.5 | 250 | 200 | 1 | f | 0.20 |
| 95 | SC-BLU-11 | 250 | 200 | 1 | f | 0.20 |
| 96 | SC-BLU-11.5 | 250 | 200 | 1 | f | 0.20 |
| 97 | SC-BLU-12 | 250 | 200 | 1 | f | 0.20 |
| 98 | SC-BLU-12.5 | 250 | 200 | 1 | f | 0.20 |
| 99 | SC-BLU-13 | 250 | 200 | 1 | f | 0.20 |
| 133 | CH-BLK-6 | 200 | 160 | 1 | f | 0.20 |
| 134 | CH-BLK-6.5 | 200 | 160 | 1 | f | 0.20 |
| 135 | CH-BLK-7 | 200 | 160 | 1 | f | 0.20 |
| 136 | CH-BLK-7.5 | 200 | 160 | 1 | f | 0.20 |
| 137 | CH-BLK-8 | 200 | 160 | 1 | f | 0.20 |
| 138 | CH-BLK-8.5 | 200 | 160 | 1 | f | 0.20 |
| 139 | CH-BLK-9 | 200 | 160 | 1 | f | 0.20 |
| 140 | CH-BLK-9.5 | 200 | 160 | 1 | f | 0.20 |
| 141 | CH-BLK-10 | 200 | 160 | 1 | f | 0.20 |
| 142 | CH-BLK-10.5 | 200 | 160 | 1 | f | 0.20 |
| 143 | CH-BLK-11 | 200 | 160 | 1 | f | 0.20 |
| 144 | CH-BRN-6 | 200 | 160 | 1 | f | 0.20 |
| 145 | CH-BRN-6.5 | 200 | 160 | 1 | f | 0.20 |
| 146 | CH-BRN-7 | 200 | 160 | 1 | f | 0.20 |
| 147 | CH-BRN-7.5 | 200 | 160 | 1 | f | 0.20 |
| 148 | CH-BRN-8 | 200 | 160 | 1 | f | 0.20 |
| 149 | CH-BRN-8.5 | 200 | 160 | 1 | f | 0.20 |
| 150 | CH-BRN-9 | 200 | 160 | 1 | f | 0.20 |
| 151 | CH-BRN-9.5 | 200 | 160 | 1 | f | 0.20 |
| 152 | CH-BRN-10 | 200 | 160 | 1 | f | 0.20 |
| 153 | CH-BRN-10.5 | 200 | 160 | 1 | f | 0.20 |
| 154 | CH-BRN-11 | 200 | 160 | 1 | f | 0.20 |
| 155 | CH-TAN-6 | 200 | 160 | 1 | f | 0.20 |
| 156 | CH-TAN-6.5 | 200 | 160 | 1 | f | 0.20 |
| 157 | CH-TAN-7 | 200 | 160 | 1 | f | 0.20 |
| 158 | CH-TAN-7.5 | 200 | 160 | 1 | f | 0.20 |
| 159 | CH-TAN-8 | 200 | 160 | 1 | f | 0.20 |
| 160 | CH-TAN-8.5 | 200 | 160 | 1 | f | 0.20 |
| 161 | CH-TAN-9 | 200 | 160 | 1 | f | 0.20 |
| 162 | CH-TAN-9.5 | 200 | 160 | 1 | f | 0.20 |
| 163 | CH-TAN-10 | 200 | 160 | 1 | f | 0.20 |
| 164 | CH-TAN-10.5 | 200 | 160 | 1 | f | 0.20 |
| 165 | CH-TAN-11 | 200 | 160 | 1 | f | 0.20 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
