~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/insert.rst

  • Committer: Lee Bieber
  • Date: 2011-02-24 03:20:47 UTC
  • mfrom: (2196.1.4 build)
  • Revision ID: kalebral@gmail.com-20110224032047-avmw06iwww3m73cw
Merge Andrew - 723653: Docs day first pass fixes 
Merge Brian - Puts back in support for COM_KILL, Also adds back in the INTERACTIVE flag, and creates a DD to track sessions/check on usage
Merge Olaf - Use List::size()

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
A type query:
7
7
 
8
 
INSERT INTO A VALUES ("1");
 
8
.. code-block:: mysql
9
9
 
 
10
   INSERT INTO A VALUES ("1");
10
11
 
11
12
.. todo::
12
13
 
13
14
   multi row inserts, performance thereof.
14
15
 
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
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):
 
17
 
 
18
.. code-block:: mysql
16
19
 
17
20
        INSERT INTO music (artist, album, date_prod, genre) VALUES
18
21
        ('Beatles', 'Abbey Road', '1969-09-26', 'rock'),
19
22
        ('The Velvet Underground', 'The Velvet Underground', '1969-03-05', 'rock');
20
23
 
21
 
or ::
 
24
or:
 
25
 
 
26
.. code-block:: mysql
22
27
        
23
28
        INSERT INTO table_1 (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
24
29
 
25
 
The following statement is incorrect since the number of values in the list does not match the number of column names: ::
 
30
The following statement is incorrect since the number of values in the list does not match the number of column names:
 
31
 
 
32
.. code-block:: mysql
26
33
 
27
34
        INSERT INTO table_1 (a,b,c) VALUES(1,2,3,4,5,6,7,8,9);
28
35
 
29
36
VALUE is a synonym for VALUES where performing a single or multirow INSERT.
30
37
 
31
 
**Performance**:
 
38
Performance
 
39
-----------
32
40
 
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'
 
41
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.