Inserting new rows with SQL In a relational database, which SQL statement is used to add (append) a new row into an existing table?

Difficulty: Easy

Correct Answer: INSERT

Explanation:


Introduction / Context:
Data manipulation involves inserting new rows, updating existing rows, and deleting unwanted rows. Knowing the correct DML verb helps you write portable SQL that behaves consistently across database vendors.



Given Data / Assumptions:

  • An existing table is available to receive a new row.
  • All required columns will be provided or will take defaults.
  • Constraints such as NOT NULL and foreign keys will be enforced.


Concept / Approach:

INSERT adds a new row to a table. CREATE defines new database objects (tables, indexes). ADD and MAKE are not standard SQL verbs for row insertion; APPEND is a common English term but not a standard SQL keyword.



Step-by-Step Solution:

Specify the statement: INSERT INTO table_name (col1, col2) VALUES (v1, v2);Alternatively, insert from a query: INSERT INTO table_name (col1, col2) SELECT ...;Validate that mandatory columns receive values or defaults.Commit or roll back the transaction as appropriate.


Verification / Alternative check:

Every major DBMS documents INSERT as the canonical row-creation command in the DML family alongside UPDATE and DELETE.



Why Other Options Are Wrong:

  • CREATE: DDL for objects, not rows.
  • ADD/MAKE/APPEND: not standard SQL row-insert verbs.


Common Pitfalls:

  • Not listing columns, which can break when schema changes. Prefer explicit column lists.
  • Violating constraints or missing foreign key references.


Final Answer:

INSERT

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion