Description: Derby supports the complete SQL-92 VALUES clause; this is very handy in several cases.
Keywords: Multiple rows VALUES clause

# Multiple rows

Derby supports the complete SQL-92 VALUES clause; this is very handy in several cases.

The first useful case is that it can be used to insert multiple rows:

    INSERT INTO OneColumnTable VALUES 1,2,3,4,5,6,7,8

    INSERT INTO TwoColumnTable VALUES
        (1, 'first row'),
        (2, 'second row'),
        (3, 'third row')

Dynamic parameters reduce the number of times execute requests are sent across:

    ij> -- send 5 rows at a time:
    ij> PREPARE p1 AS 'INSERT INTO ThreeColumnTable VALUES
    (?,?,?), (?,?,?), (?,?,?), (?,?,?), (?,?,?)';
    ij> EXECUTE p1 USING 'VALUES (''1st'',1,1,''2nd'',2,2,''3rd'',
    3,3,''4th'',4,4,''5th'',5,5)';

Parent topic: Tricks of the VALUES clause
Related concepts
Mapping column values to return values
Creating empty queries