3 SQL::Abstract::Manual::Specification
7 These are the examples for the AST
11 The following are example SQL statements and the AST that would represent each
12 one. The SQL used is from the MySQL dialect.
20 ast_version => 0.0001,
30 =item * SELECT NOW() AS time FROM dual AS duality
34 ast_version => 0.0001,
55 =item * SELECT 1 FROM foo LEFT OUTER JOIN bar ON ( foo.col1 = bar.col2 )
59 ast_version => 0.0001,
99 =item SELECT * FROM foo WHERE name = 'John'
103 ast_version => 0.0001,
106 type => 'Identifier',
111 type => 'Identifier',
119 type => 'Identifier',
131 =item SELECT COUNT(*) FROM foo WHERE name = 'John' AND ( title = 'Mr' OR abbrev = 'Dr' )
135 ast_version => 0.0001,
142 type => 'Identifier',
149 type => 'Identifier',
161 type => 'Identifier',
180 type => 'Identifier',
195 type => 'Identifier',
196 element1 => 'abbrev',
211 =item SELECT COUNT(DISTINCT(*)) FROM foo WHERE ( name = 'John' AND title = 'Mr' ) OR abbrev = 'Dr'
215 ast_version => 0.0001,
226 type => 'Identifier',
235 type => 'Identifier',
251 type => 'Identifier',
266 type => 'Identifier',
283 type => 'Identifier',
284 element1 => 'abbrev',
297 =item * SELECT foo, bar baz FROM foo ORDER BY bar, baz DESC GROUP BY 1,3,2
301 ast_version => 0.0001,
304 type => 'Identifier',
308 type => 'Identifier',
312 type => 'Identifier',
317 type => 'Identifier',
322 type => 'OrderbyComponent',
324 type => 'Identifier',
330 type => 'OrderbyComponent',
332 type => 'Identifier',
340 type => 'GroupbyComponent',
348 type => 'GroupbyComponent',
356 type => 'GroupbyComponent',
366 =item * UPDATE foo SET col1 = 1
370 ast_version => 0.0001,
372 type => 'Identifier',
377 type => 'SetComponent',
391 =item * INSERT INTO foo ( col1, col2 ) VALUES ( 1, 3 )
395 ast_version => 0.0001,
397 type => 'Identifier',
424 =item * DELETE FROM foo WHERE col1 = 10
428 ast_version => 0.0001,
430 type => 'Identifier',
438 type => 'Identifier',
454 robkinyon: Rob Kinyon C<< <rkinyon@cpan.org> >>
458 You may distribute this code under the same terms as Perl itself.