Adding Multiple Rows to a Table : Insert « Insert Update Delete « Oracle PL/SQL Tutorial






SQL>
SQL> CREATE TABLE Student (
  2     StudentID INT NOT NULL PRIMARY KEY,
  3     Name      VARCHAR(50) NOT NULL);

Table created.

SQL>
SQL> INSERT INTO Student (StudentID,Name) VALUES (1,'Tom');

1 row created.

SQL> INSERT INTO Student (StudentID,Name) VALUES (2,'Jack');

1 row created.

SQL> INSERT INTO Student (StudentID,Name) VALUES (3,'Mary');

1 row created.

SQL> INSERT INTO Student (StudentID,Name) VALUES (4,'Bill');

1 row created.

SQL> INSERT INTO Student (StudentID,Name) VALUES (5,'Cat');

1 row created.

SQL>
SQL>
SQL> CREATE TABLE Professor (
  2     ProfessorID INT NOT NULL PRIMARY KEY,
  3     Name        VARCHAR(50) NOT NULL);

Table created.

SQL>
SQL>
SQL> INSERT INTO Professor (ProfessorID, Name)
  2     SELECT StudentID + 7, Name
  3     FROM Student;

5 rows created.

SQL>
SQL> drop table Professor;

Table dropped.

SQL> drop table Student;

Table dropped.








4.1.Insert
4.1.1.Adding Rows Using the INSERT Statement
4.1.2.Omitting the Column List
4.1.3.Insert value for specific columns
4.1.4.Specifying a Null Value for a Column
4.1.5.Including Single and Double Quotes in a Column Value
4.1.6.Insert double quote
4.1.7.Use trunc in insert statement
4.1.8.Combine three tables with 'insert into statement'
4.1.9.Insert default value
4.1.10.Truncate sysdate in insert statement
4.1.11.Adding Multiple Rows to a Table
4.1.12.Conditional INSERT Statement
4.1.13.to_date() and insert statement
4.1.14.To insert records into a table using a subquery: