Logo

K-Learn

SQL Insert Into

< Previous Next >

The INSERT statement in SQL is used to add new records (rows) to a table. To create a new record in the "student" table, we need to specify values for each column in the table.

Insert Into Syntax

INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);

For example, let's say we want to add a new student with the following information:

  • id: 1

  • name: John Doe

  • email: john.doe@example.com

  • phone: 123-456-7890

  • address: 123 Main St, Anytown USA

By using the INSERT statement, we can add new records to a table in SQL and populate it with the data we need to work with.

We would use the following SQL statement:

INSERT INTO student (id, name, email, phone, address)
VALUES (1, 'John Doe', 'john.doe@example.com', '123-456-7890', '123 Main St, Anytown USA');

OUTPUT

In this above SQL INSERT Example,

This SQL statement inserts a new row into the "student" table with the values of "id" 1, "name" 'John Doe', "email" 'john.doe@example.com', "phone" '123-456-7890', and "address" '123 Main St, Anytown USA'. The values are enclosed in parentheses and separated by commas.


< Previous Next >