Update multiple rows and columns at the same time

Question

We want to increase the price of the tennis courts for both members and guests. Update the costs to be 6 for members, and 30 for guests.

Expected Results

facidnamemembercostguestcostinitialoutlaymonthlymaintenance
2Badminton Court015.5400050
3Table Tennis0532010
4Massage Room 1358040003000
5Massage Room 2358040003000
6Squash Court3.517.5500080
7Snooker Table0545015
8Pool Table0540015
0Tennis Court 163010000200
1Tennis Court 26308000200

Your Answer

Your Results

Loading database...

Answers and Discussion

update cd.facilities
    set
        membercost = 6,
        guestcost = 30
    where facid in (0,1);
The SET clause accepts a comma separated list of values that you want to update.