SQL INSERT: Difference between revisions
Jump to navigation
Jump to search
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=External= | |||
=Internal= | =Internal= | ||
* [[SQL#INSERT|SQL]] | * [[SQL#INSERT|SQL]] | ||
Line 5: | Line 6: | ||
<syntaxhighlight lang='sql'> | <syntaxhighlight lang='sql'> | ||
INSERT INTO person | INSERT INTO person (id, name) VALUES (1, 'Binh Ngo'); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
:{| class="wikitable" style="text-align: left;" | :{| class="wikitable" style="text-align: left;" | ||
Line 12: | Line 13: | ||
|- | |- | ||
|} | |} | ||
The column names and the values provided must correspond in number and type. The <code>INSERT</code> statement may not contain a <code>[[SQL_WHERE#Overview|WHERE]]</code> clause, because there is no previous data for this row <code>WHERE</code> may apply to. | |||
=Conditional <tt>INSERT</tt>= | |||
Also see: {{Internal|SQL_Conditional_Logic#Overview|SQL Conditional Logic}} |
Latest revision as of 21:10, 30 May 2024
External
Internal
Overview
INSERT INTO person (id, name) VALUES (1, 'Binh Ngo');
PostgreSQL MySQL
The column names and the values provided must correspond in number and type. The INSERT
statement may not contain a WHERE
clause, because there is no previous data for this row WHERE
may apply to.
Conditional INSERT
Also see: