Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple tables Not IN Filling with Nulls
    primarykey
    data
    text
    <p>I have 4 tables:</p> <p><strong>Table 1:</strong> <code>batch_info with columns batch_id, brew_date, beer_style_name</code></p> <p><strong>Table 2:</strong> <code>brew_fermentation with columns batch_id (FK of batch_info), fermentor_name (FK of fermentor),.</code>.</p> <p><strong>Table 3:</strong> <code>fermentor with columns, fermentor_name, tank_volume</code></p> <p><strong>Table 4:</strong> <code>Produced_amount with columns batch_id(FK of batch_info), produced_amount, date_transferred</code></p> <p>When a beer is brewed we enter it into Table 1 and Table 2, When the beer is done fermenting we then enter the data into table 4 produced_amount. </p> <p>I would like to create is a table that looks something like this</p> <pre><code>Fermentor # | Batch_ID | Tank_Size | Date_Brewed | Beer Style F10.1 13001 10 2013-01-12 IPA F20.2 NULL 20 NULL EMPTY </code></pre> <p>I have the following SQL statement. </p> <p>However it will not show all of the fermentors from the fermentor table only the ones that currently have something in them. I would like to populate the the table like above.</p> <pre><code>SELECT brew_fermentation.fermentor_name AS "Fermentor #", batch_info.batch_id AS "Batch Number", batch_info.beer_style_name AS "Beer Style", batch_info.date_brewed AS "Date Brewed", fermentor.tank_volume AS "BBLs" FROM batch_info, fermentor, brew_fermentation WHERE batch_info.batch_id = brew_fermentation.batch_id AND brew_fermentation.fermentor_name=fermentor.fermentor_name AND batch_info.batch_id NOT IN (SELECT produced_amount.batch_id FROM produced_amount) ORDER BY batch_info.date_brewed </code></pre>
    singulars
    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.
 

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