I have a student
table and a takes
table. The takes
table is for courses that students have taken or are currently taking, and has columns:
ID, course_id, sec_id, semester, year, grade
I want to use ID
from student
but then for the other 5 columns use:
(CS-001, 1, Fall, 2009, NULL)
I know how to use insert into takes select, from, where
, and also insert into takes values()
But I have not seen anything that mixes data from another table and also new data that I put in. The labs we are doing are supposed to be done all in MySQL queries, using phpMyAdmin.
I am poor at explaining things so I am sorry if this does not make sense. Thank you for your help.
Here is the sort of query I want:
insert into takes(ID, course_id, sec_id, semester, year, grade)
values(*IDs from student table*, CS-001, 1, Fall, 2009, NULL);