[英]How to use select statement to insert values on a table
I am trying to insert theses values to my table student but I have an error 我正在尝试将这些值插入我的餐桌学生,但出现错误
insert into student(first_name,last_name,student_number,professor_id)
values(Eden,Yuan,323744573,
select professor_id from PROFESSORS where professor_name = 'Chu ')
I get an error 我得到一个错误
saying missing expression
说缺少表达
you can use this way (assuming that professor_id is the column you need) 您可以使用这种方式(假设Professor_id是您需要的列)
insert into student(first_name,last_name,student_number,professor_id)
select 'Eden', 'Eden', 323744573, column_professor_id
from PROFESSORS where professor_name = 'Chu ' ;
(In your query is missing the column in the select ) (在您的查询中缺少select中的列)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.