insert into Table3(StuID,CourseID,Hours,Credit,Grade)
select stuid , (select courseid from table2 where courseno = '12345'),35,5,80
from table1
where stuid = '01234567'