Answer the question
In order to leave comments, you need to log in
How to add a row to a table given an id from another table?
there are two tables: task(task) with fields id, title, coment, status, user_id
and
table user with fields id, name, surname, spec, email,
password user from user table? Accordingly, the user_id field from
the task table should take the value id from the user table.
Answer the question
In order to leave comments, you need to log in
It will be a normal INSERT, only you yourself must substitute the required user_id in the data. Data integrity check can be done using the foreign keys of the table, then the database will not allow creating a record with a non-existent user_id in the user table
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question