--use when doing the test.
-Cons: The number of result sets is the same as the type.
INSERT into Student (StudentID, Studentname, Stduentage, Studentbirthday, Studentgender, Studentphone, Studentemail, Studentaddress, Student_courseid) SELECT StudentID, Studentname, Stduentage, Studentbirthday, Studentgender, Studentphone, Studentemail, studentaddress, Student_courseid from dbo. Student
Take a look at this sql:
INSERT into dbo. ClassSELECT'1102','Software 1102'UNION SELECT'1103','Software 1103'UNION SELECT'1104','Software 1104'UNION SELECT'1105','Software 1105'UNION SELECT'1106','Software 1106'UNION SELECT'1106','Software 1106'
Yellow sql: The result of the execution is:
(No column name) (No column name)
1102 Software 1102
1103 Software 1103
1104 Software 1104
1105 Software 1105
1106 Software 1106
We have learned the Union keyword and will automatically remove duplicate data. So only 5 data was queried.
Now fully execute the above sql:
See the number of rows affected: 5
SQL---Inserting multiple data at a time