Lesson #4: Inserting Data
Inserting data is very important because without it database management systems wouldn’t be worth much. While inserting data isn’t complex, many developers learn one pattern and stick with it exclusively because it works. The intent of this lesson is to explain how and why the INSERT
statement works. It shows you how to insert one or more rows in a database by using positional and named notation. These methods work whether or not you’ve implemented referential integrity in your model (through foreign key constraints).
The summaries for the lesson components are:
- Insertion Signatures
- Learn what are the default and overriding signatures, and how to implement them in the supported SQL dialects.
- INSERT Statement
- Learn the ways you can write single and multiple row
INSERT
statements for the supported SQL dialects. - Automatic Numbering
- Learn how to use sequences for surrogate keys by SQL dialect.
- Transaction Management
- Learn how to use stored procedures to manage transactions across multiple DML statements in Oracle and MySQL.
- Scalar Subqueries
- Learn about scalar subqueries and how to use them to automate primary key lookup values by using an external table’s natural key.