L
L
Levomecol2022-04-21 14:39:51
SQL
Levomecol, 2022-04-21 14:39:51

How to pull additional course and student id information from one table and put into another?

I have a database which has a PurchaseList table. It contains the following fields: student_name,
course_name, price, subscriptionDate. The task is to use the table PurcahseList to pull out additional. information (ID of the course and student) and add everything to another table with the fields: student_id and course_id.
How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Mikhailov, 2022-04-22
@Levomecol

Well, something like this, depending on what database.
INSERT INTO other_table (student_id, course_id)
VALUES (SELECT course_id, student_id FROM PurchaseList)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question