DML
DML statements are used for managing data within schema objects. They consist of INSERT
, UPDATE
, UPSERT
, and DELETE
statements and are generally referred to as statements that insert, update, or delete the data in a database. We will go over the syntax of INSERT
, UPDATE
, UPSERT
, and DELETE
statements used for a table in this section.
The INSERT
statement takes the following parameters:
common_table_expression
: Common table expressions (CTEs) provide a shorthand for a subquery, to improve the readability.table_name
: Name of the table into which the data is inserted.AS table_alias
: Alias for the table name.column_name
: Name of the column that is being populated.select_statement
: A selection query, whose result is used to insert the data. The column order and column data types of theSELECT
query result should match that of the table into which the data is getting inserted.
Here is an example of INSERT INTO
:
INSERT INTO users(id, name...