How to Insert Data in SQL?

Use the `INSERT INTO` statement

Specify the table name

List the target columns

Provide the values in the same order as the columns

Use `VALUES` to insert a single row

Use multiple value sets to insert multiple rows

Use `INSERT INTO … SELECT` to insert data from another query

Match data types with the target columns

Omit columns that allow default or `NULL` values if needed

Use `DEFAULT` for columns with default values

Use `NULL` for columns that accept nulls

Ensure string values are enclosed in quotes

End the statement with a semicolon

Verify constraints such as `PRIMARY KEY`, `FOREIGN KEY`, and `NOT NULL` before inserting

Suggested for You

Trending Today