~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/insert.rst

  • Committer: patrick crews
  • Date: 2011-02-23 17:17:25 UTC
  • mto: (2195.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2196.
  • Revision ID: gleebix@gmail.com-20110223171725-4tgewemxhsw1m7q8
Integrated randgen with dbqp.  We now have mode=randgen and a set of randgen test suites (very basic now).  Output = same as dtr : )  We also have mode=cleanup to kill any servers we have started.  Docs updates too.  Gendata utility allows us to populate test servers 

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
8
INSERT INTO A VALUES ("1");
9
9
 
10
10
 
 
11
.. todo::
 
12
 
 
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'