📜  pl sql insert into table - SQL (1)

📅  最后修改于: 2023-12-03 15:33:42.893000             🧑  作者: Mango

PL/SQL Insert Into Table - SQL

Introduction

In PL/SQL, the Insert statement is used to add data to a table. This SQL command is used to insert data into an existing table in a database.

The syntax for the SQL Insert statement is as follows:

insert into table_name (column1, column2, column3, ...)
values (value1, value2, value3, ...);
Syntax Explanation
  • table_name: name of the table which the data will be inserted.
  • column_name: specify the column names that you want to insert data into.
  • value: specify the value for each column (corresponding to the order of the columns in the column_list).
Example

Suppose we have a table named "Student" with columns: StudentID, Name, Age, Gender, Address.

Now, we want to add a new row with the following data:

  • StudentID: 1001
  • Name: 'John'
  • Age: 20
  • Gender: 'M'
  • Address: '123 Main St.'

The insert statement will be:

insert into Student (StudentID, Name, Age, Gender, Address)
values (1001, 'John', 20, 'M', '123 Main St.');
Conclusion

Inserting data into a table is a common operation in PL/SQL programming. By using the Insert statement, we can easily add data to an existing table.