To help increase sales, your management decides to give customers a one-time bonus.

Here are the credit rules:

for 1-15 credits, add 1 credit
for 16-30 credits, add 2 credits
for 31+ credits, add 10% and round up (10% of 35 is 3.5, rounded up to 4)

Write an update statement that uses those rules to add credit to a customer's account.

Save your query as dba1lesson7project2.sql and then hand it in.

This is my project and below is what I have so far but I'M guessing that I've missed the mark by a long shot. Could you please steer me in the right direction? Thanks. The table is CustomerAccounts and the column is CurrentCredit.

update CustomerAccounts
set CurrentCredit = CurrentCredit + 1
where CurrentCredit > 1 and <= 15,

set CurrentCredit = CurrentCredit + 2
where CurrentCredit >15 and <= 30,

set CurrentCredit = CurrentCredit + 10%
where CurrentCredit >= 31;

Recommended Answers

All 2 Replies

1) are you sure you could write CurrentCredit > 1 AND <= 15 I'm guessing the proper syntax is CurrentCredit > 1 AND CurrentCredit <= 15
2) CurrentCredit + 10% ?? I wouldn't understand it if I were MySql! CurrentCredit*1,1 is more wise.
Did you try your code on a db ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.