Home > database >  SQL database, insert the data in table form
SQL database, insert the data in table form

Time:10-13

Insert into the teacher
(
Tno, tn, sex, age, initial, sal, comm, school
)
Values
(
(' t1 ', 'Mr. Lee' and 'male', '47', 'professor', '6000', '3000', 'intellectual families'),
(' t2 ', 'wang yu', 'female' and '28', 'lecturers',' 3000 ', '1500', 'financial'),
T3 (' a ', 'liu' and 'male', '30', 'lecturers',' 3500 ', '1800', 'intellectual families'),
(' t4 ', 'xue-li zhang', 'female' and '51', 'professor', '6500', '3400', 'accounting'),
(' 0 ', 'Zhang Lanyu', 'female' and 'and', 'associate professor', '5500', '2300', 'construction')
)
Go


Turn to help see, each input here, and then has been displayed in the ', 'have grammar mistakes

CodePudding user response:

Don't use curly braces, each data a parenthesis, commas, finally a data with a semicolon

CodePudding user response:

Insert into the teacher
(tno, tn, sex, age, initial, sal, comm, school)
Values
(' t1 ', 'Mr. Lee' and 'male', '47', 'professor', '6000', '3000', 'intellectual families'),
(' t2 ', 'wang yu', 'female' and '28', 'lecturers',' 3000 ', '1500', 'financial'),
T3 (' a ', 'liu' and 'male', '30', 'lecturers',' 3500 ', '1800', 'intellectual families'),
(' t4 ', 'xue-li zhang', 'female' and '51', 'professor', '6500', '3400', 'accounting'),
(' 0 ', 'Zhang Lanyu', 'female' and 'and', 'associate professor', '5500', '2300', 'construction');

CodePudding user response:

You put the bottom GO to, also can write so
 insert into the teacher (tno, tn, sex, age, initial, sal, comm, school) 
[code=SQL]

SELECT 't1', 'Mr. Lee' and 'male', '47', 'professor', '6000', '3000', 'intellectual families' UNION ALL
SELECT 't2', 'wang yu', 'female' and '28', 'lecturers',' 3000 ', '1500', 'financial' UNION ALL
SELECT 't3', 'liu' and 'male', '30', 'lecturers',' 3500 ', '1800', 'intellectual families' UNION ALL
SELECT 't4', 'xue-li zhang', 'female' and '51', 'professor', '6500', '3400', 'accounting' UNION ALL
SELECT '0', 'Zhang Lanyu', 'female' and '39, associate professor,' ', '5500', '2300', 'construction' [/code]

CodePudding user response:

 insert into the teacher (tno, tn, sex, age, initial, sal, comm, school) 
SELECT 't1', 'Mr. Lee' and 'male', '47', 'professor', '6000', '3000', 'intellectual families' UNION ALL
SELECT 't2', 'wang yu', 'female' and '28', 'lecturers',' 3000 ', '1500', 'financial' UNION ALL
SELECT 't3', 'liu' and 'male', '30', 'lecturers',' 3500 ', '1800', 'intellectual families' UNION ALL
SELECT 't4', 'xue-li zhang', 'female' and '51', 'professor', '6500', '3400', 'accounting' UNION ALL
SELECT '0', 'Zhang Lanyu', 'female' and '39, associate professor,' ', '5500', '2300', 'construction'