[DUG] Using Queries

Adrian Williams adrian at aerosupport.co.nz
Mon Jun 13 10:05:05 NZST 2022


Hi all

I wonder if someone could clarify something regarding Queries.

I understand that if you run a query on a table it returns a  subset or 
snapshot of data from the table based on the SQL statement supplied. (In 
my Paradox days, a query created an 'ANSWER' table that could be 
navigated as a table, but was separate from the original data).

What I have discovered (more by accident), is that if you edit records 
in the query data and call  the query's POST method it will post the 
changes back to original table. Also by using the APPEND and INSERT 
methods on the query, you can create new records in the base table. What 
I have been able to ascertain is that the database engine seamlessly 
creates the SQL code to run UPDATE and INSERT statements to amend the 
original table in the background.

My question is: Is this a 'proper' and acceptable way of updating a 
table by modifying the Query data? Or is this fraught with danger and 
bad practice?

Appreciate any comments on this.

Regards
Adrian Williams


More information about the Delphi mailing list