Mimer SQL User's Manual TOC PREV NEXT INDEX

Mimer Developer Site

www.mimer.com/developer


Updating Tables


Data in existing table rows can be changed with the UPDATE statement. This statement has the general form:

 UPDATE table
 SET column = value
 [WHERE search-condition];
 

The search condition specifies which rows in the table are to be updated. If no search condition is specified, all rows will be updated.

Update the exchange rate for US dollars to 7.25:
 UPDATE EXCHANGE_RATE
 SET    RATE = 7.25
 WHERE  CURRENCY = 'USD';
 
Add 20 to the 1997-08-08 to 1997-11-14 price of a no-smoking, single room with shower in the Hotel Laponia:
 UPDATE ROOM_PRICES
 SET    PRICE = PRICE + 20
 WHERE  ROOMTYPE  = 'NSSGLS'
 AND    FROM_DATE = DATE '1997-08-08'
 AND    TO_DATE   = DATE '1997-11-14'
 AND    HOTELCODE = (SELECT HOTELCODE
        FROM   HOTEL
        WHERE  NAME = 'LAPONIA');
 

When a subselect is used in the search condition, the table being updated may not be used in the subselect.

Primary key columns can be updated provided the table is stored in a databank with the TRANS or LOG option.



Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
dbtechnology@upright.se
Mimer SQL User's Manual TOC PREV NEXT INDEX