The DELETE command removes records from the relational database based on the selection criteria.
SQT1 – the SQL Trigger block uses the DELETE command in the SQLLIB table. The DELETE command executes the following statement when the SQT block triggers:
Delete from TBL1 where COL3 = ?;
SQD1 – the SQL Data block references a tag and field name combination in the database, and sets the direction for the data transfer to OUT.
T01-.DO1.A_ADI
T02-.
T03-.
T04-.
TBL1 – is the table referenced by the DELETE command used by the SQT block.
COL1 |
COL2 |
COL3 |
Pump stage 101 |
99.7 |
NONE |
Temp Zone 2 (C) |
-2.1 |
ByeBye |
Manual Override |
.004 |
NONE |
Deadband |
9 |
ALL |
Explanation
The value of DO1.A_ADI is equal to NONE. When the software executes this command, the value is read and substituted into the SQL command. The command is then:
Delete from TBL1 where COL3 = `NONE';
Since both row one and row three have `NONE' as the value in column three, they are both deleted. The resulting table is shown below:
COL1 |
COL2 |
COL3 |
Temp Zone 2 (C) |
-2.1 |
ByeBye |
Deadband |
9 |
ALL |