Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP - mysql multiple table subqueries
    primarykey
    data
    text
    <p>I create a table based using lots of foreign keys. What I want to do is how to use them properly according to their primary keys. If insert the values it will automatically insert it to subtables.</p> <p>The parent table would be the evaluation_tbl and its child table would be accomp_tbl,task_tbl, and employee_tbl, all these child tables are connected to the parent table via foreign key. While accomp_tbl has a child table called quality_tbl. Here's an example:</p> <pre><code>**| evaluation_tbl with 5 columns:|** *eval_id(pk) *percent *task_id(fk) *accomp_id(fk) *employee_id(fk) **| accomp_tbl with 2 columns |** *accomp_id(pk) *quality_id(fk) **| quality_tbl with 2 columns |** *quality_id(pk) *value **| task_tbl with 4 columns |** *task_id(pk) *task_name(fk) *task_sem(fk) *task_yr(fk) **| employee_tbl with 2 columns |** *employee_id(pk) *employee_name </code></pre> <p>All primary keys are auto-increment.</p> <p>Herees what I want to do:</p> <p>A <strong>form</strong> that represents the <strong>input for evaluation_tbl</strong>. I have to <strong>input the value for column name "weight", select a task_id, then input a value for column name "quality" which is a column in quality_tbl</strong>. Evaluation_tbl will query accomp_tbl while accomp_tbl will query quality_tbl. </p> <p><strong>If I perform an insert or delete for a particular evaluation_id, it will also do the action for accomp_id and quality_id</strong>. I believe this is a subquery with LEFT JOIN and foreign key constraint is cascade.</p> <p>But I don't know how exactly what to do. Please help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload