================================================================================ basic ================================================================================ insert into my_table values (1); -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (insert_items (insert_values (insert_item (number)) ) ) ) ) ================================================================================ insert into table by specified columns ================================================================================ insert into my_table (name, email, display_name) values ('foo', 'bar@biz.baz', 'Foo bar'); -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (columns (identifier) (identifier) (identifier) ) (insert_items (insert_values (insert_item (string)) (insert_item (string)) (insert_item (string)) ) ) ) ) ================================================================================ insert into table by specified columns with many values ================================================================================ insert into my_table (name, email, display_name) values ('foo', 'bar@biz.baz', 'Foo bar'), ('foo', 'bar@biz.baz', 'Foo bar'), ('foo', 'bar@biz.baz', 'Foo bar'); -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (columns (identifier) (identifier) (identifier) ) (insert_items (insert_values (insert_item (string)) (insert_item (string)) (insert_item (string)) ) (insert_values (insert_item (string)) (insert_item (string)) (insert_item (string)) ) (insert_values (insert_item (string)) (insert_item (string)) (insert_item (string)) ) ) ) ) ================================================================================ insert into table with alias ================================================================================ insert into foo.my_table as alias values(1); -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (as (identifier)) (insert_items (insert_values (insert_item (number)) ) ) ) ) ================================================================================ insert into default values ================================================================================ insert into foo.my_table default values; -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (insert_items) ) ) ================================================================================ insert into with many value items ================================================================================ insert into foo.my_table values (1, 2); -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (insert_items (insert_values (insert_item (number)) (insert_item (number)) ) ) ) ) ================================================================================ insert into with different kind of value items ================================================================================ insert into foo.my_table values (1, DEFAULT, (select 1, 2)); -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (insert_items (insert_values (insert_item (number)) (insert_item) (insert_item (select_statement (select_item (number)) (select_item (number)) ) ) ) ) ) ) ================================================================================ insert into from select ================================================================================ insert into foo.my_table select column1 from foo bar; -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (insert_items (select_statement (select_item (identifier)) (select_from (from_item (from_table (identifier) (identifier) ) ) ) ) ) ) ) ================================================================================ insert into a table with the select enclosed in parentheses ================================================================================ insert into foo.my_table (select column1 from foo bar); -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (insert_items (select_statement (select_item (identifier)) (select_from (from_item (from_table (identifier) (identifier) ) ) ) ) ) ) ) ================================================================================ insert into with returning clause ================================================================================ insert into foo values (1) returning *, 1; -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (insert_items (insert_values (insert_item (number)) ) ) (returning (select_item (star)) (select_item (number)) ) ) ) ================================================================================ insert into using with clause ================================================================================ with foo as (select * from bar) insert into my_table values (1); -------------------------------------------------------------------------------- (source_file (insert_statement (with_query (with_query_item (identifier) (select_statement (select_item (star)) (select_from (from_item (from_table (identifier) ) ) ) ) ) ) (identifier) (insert_items (insert_values (insert_item (number)) ) ) ) ) ================================================================================ insert into statement with returning into clause ================================================================================ insert into foo (bar, baz) select * from another returning id into _var; -------------------------------------------------------------------------------- (source_file (insert_statement (identifier) (columns (identifier) (identifier) ) (insert_items (select_statement (select_item (star)) (select_from (from_item (from_table (identifier) ) ) ) ) ) (returning (select_item (identifier)) ) (into (identifier)) ) )