Inserting data rowsINSERT [ into] <Table name> [Column Name] VALUES <Value List>INSERT intoStudents (sname,saddress,sgrade,semail,ssex)VALUES('Zhang Qing cutting','Shanghai Songjiang',6,'[email protected]',0) Precautions:1: It is not possible to insert only half a row or columns of data each time a row is inserted, so whether the inserted data is valid will be checked according to the integrity of the entire line;2: The data type, precision, and scale of each data value must match the corresponding column;3: Cannot specify a value for an identity column because its number is automatically increased;4: If you specify that a column is not allowed to be empty when you design the table, you must insert the data;5: An inserted data item that requires compliance with the requirements of the check constraint6: Columns with default values, you can insert multiple rows of data using the default (default) keyword instead of the inserted value 1INSERT into <Table name>(column name)SELECT <Column Name> from <source table Name>INSERT intoTongxunlu ('name','Address','Email')SELECTSname,saddress,semail fromStudents inserting multiple rows of data2SELECT(column name) into <Table name> from <source table Name>SELECTStudents.sname,students.saddress,students.semail intoTongxunlu fromstudents The question is, how do I insert a new identity column when select INTO inserts multiple rows of data? SELECT IDENTITY(data type, identity seed, identity growth) asColumn Name intoNew Table fromOriginal TableSELECTStudents.sname,students.saddress,students.semail,IDENTITY(int,1,1) asStudentID intoTongxunluex fromStudents inserting multiple rows of data3INSERT into <Table name>(column name)SELECT <Column Name> UNIONSELECT <Column Name> UNION...INSERTSTUDENTS (sname,sgrade,ssex)SELECT 'Test Girl 1',7,0 UNIONSELECT 'Test Girl 2',7,0 UNIONSELECT 'Test Girl 3',7,0 UNIONSELECT 'Test Girl 4',7,0 UNIONSELECT 'Test Girl 1',7,0 UNIONSELECT 'Test Boys 2',7,1 UNIONSELECT 'Test Boys 3',7,1 UNIONSELECT 'Test Boys 4',7,1 UNIONSELECT 'Test Boys 5',7,1Update Data rowsUPDATE <Table name> SET <Column Name=Update values>[WHERE < update conditions >]UPDATEScoresSETScores=Scores+ 5WHEREScores<= theDelete data rowsDELETE from <Table name> [WHERE < Delete condition >]or:TRUNCATE TABLE <Table name>here Delete fromStudents=TRUNCATE TABLEStudents querying data rows because data queries are the most common way to manipulate data rows, we discuss them separately below.
T-SQL (5)-Operation Data Line (RUI)