~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/insert.rst

  • Committer: Lee Bieber
  • Date: 2011-02-23 05:05:43 UTC
  • mfrom: (2193.1.2 build)
  • Revision ID: kalebral@gmail.com-20110223050543-w0nhgf512s0137mm
Merge Andrew - 723389: ORDER BY on sys_replication_log table causes InnoDB crash
Merge Marisa - documentation updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Inserting Data
2
2
==============
3
3
 
4
 
In Dizzle you can make use of INSERT in order to insert data into a table.
 
4
In Drizzle you can make use of INSERT in order to insert data into a table.
5
5
 
6
6
A type query:
7
7
 
8
 
.. code-block:: mysql
9
 
 
10
 
   INSERT INTO A VALUES ("1");
 
8
INSERT INTO A VALUES ("1");
11
9
 
12
10
 
13
11
.. todo::
14
12
 
15
13
   multi row inserts, performance thereof.
 
14
 
 
15
INSERT statements that use VALUES syntax can insert multiple rows. To do this, use the multirow VALUES syntax (include multiple lists of column values, each enclosed within parentheses and separated by commas): ::
 
16
 
 
17
        INSERT INTO music (artist, album, date_prod, genre) VALUES
 
18
        ('Beatles', 'Abbey Road', '1969-09-26', 'rock'),
 
19
        ('The Velvet Underground', 'The Velvet Underground', '1969-03-05', 'rock');
 
20
 
 
21
or ::
 
22
        
 
23
        INSERT INTO table_1 (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
 
24
 
 
25
The following statement is incorrect since the number of values in the list does not match the number of column names: ::
 
26
 
 
27
        INSERT INTO table_1 (a,b,c) VALUES(1,2,3,4,5,6,7,8,9);
 
28
 
 
29
VALUE is a synonym for VALUES where performing a single or multirow INSERT.
 
30
 
 
31
**Performance**:
 
32
 
 
33
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. 
 
 
b'\\ No newline at end of file'