Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A decision table is a cluster of conditions and actions. A condition can be simple enough that you can represent it with a simple "match a column against this value" string. Or a condition could be hellishly complex. An action, similarly, could be as simple as "move this value to a column". Or the action could involve multiple parts or steps or -- well -- anything.</p> <p>A CASE function in a SELECT or WHERE clause <em>is</em> a decision table. This is the first example of decision table "in" a relational database. </p> <p>You can have a "transformation" table with columns that have old-value and replacement-value. You can then write a small piece of code like the following.</p> <pre><code>def decision_table( aRow ): result= connection.execute( "SELECT replacement_value FROM transformation WHERE old_value = ?", aRow['somecolumn'] ) replacement= result.fetchone() aRow['anotherColumn']= result['replacement_value'] </code></pre> <p>Each row of the decision table has a "match this old_value" and "move this replacement_value" kind of definition.</p> <p>The "condition" parts of a decision table have to be evaluated somewhere. Your application is where this will happen. You will fetch the condition values from the database. You'll use those values in some function(s) to see if the rule is true.</p> <p>The "action" parts of a decision table have to be executed somewhere; again, your application does stuff. You'll fetch action values from the database. You'll use those values to insert, update or delete other values.</p> <p>Decision tables are used all the time; they've always been around in relational databases. Each table requires a highly customized data model. It also requires a unique condition function and action procedure.</p> <p>It doesn't generalize well. If you want, you could store XML in the database and invoke some rules engine to interpret and execute the BPEL rules. In this case, the rules engine does the condition and action processing.</p> <p>If you want, you could store Python (or Tcl or something else) in the database. Seriously. You'd write the conditions and actions in Python. You'd fetch it from the database and run the Python code fragment.</p> <p>Lots of choices. None of the "academic". Indeed, the basic condition - action stuff is done all the time.</p>
 

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