"Fossies" - the Fresh Open Source Software Archive

Member "drizzle-7.1.36-stable/docs/insert.rst" (6 May 2012, 1231 Bytes) of package /linux/misc/old/drizzle-7.1.36-stable.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

Inserting Data

In Drizzle you can make use of INSERT in order to insert data into a table.

A type query:

INSERT INTO A VALUES ("1");

INSERT statements that use VALUES syntax can insert multiple rows. To do this, use the multi row VALUES syntax (include multiple lists of column values, each enclosed within parentheses and separated by commas):

INSERT INTO music (artist, album, date_prod, genre) VALUES
    ('Beatles', 'Abbey Road', '1969-09-26', 'rock'),
('The Velvet Underground', 'The Velvet Underground', '1969-03-05', 'rock');

or:

INSERT INTO table_1 (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

The following statement is incorrect since the number of values in the list does not match the number of column names:

INSERT INTO table_1 (a,b,c) VALUES(1,2,3,4,5,6,7,8,9);

VALUE is a synonym for VALUES where performing a single or multirow INSERT.

Performance

A multi-row INSERT involving three rows will require roughly one third of the time required to execute the three single-row statements. This performance improvement can become quite significant over a large number of statements.