Querying SQL Tables by Keith Oustalet
Low-level Database Access
heitml provides a number of Database Application Components with hi-level tools for database access, and you will normally want to use them in developing your Web Pages rather than the methods discussed here. Therefore, the information in this last portion of our introduction to SQL Databases is provided merely to complete the foundation or "reference" material you need in order to understand the more advanced concepts explained in subsequent sections. Nearly all of the Tags in the heitml Database Libraries are built upon low-level primitives such as we dbupdate (which we've seen in previous pages) and dbquery (the subject of this page). Therefore, it is to your advantage to have at least a basic understanding of how they work.
We'll start here with a simple example and then build on it, with subsequent examples becoming progressively more complex. Along the way, you'll not only develop an appreciation for the usefulness of the dbquery command, but you should also come away with ideas to use when addressing specific problems in the applications you develop.
Extracting FIELD NAMES from an SQL TABLE
Normally, you would expect to know the field names already, assuming that the SQL TABLE or DATABASE resides on your own server. But let's pretend for a moment that you can't remember the fields for a particular TABLE, and you're too lazy (or too engrossed with your current programming assignment) to consult whatever documentation you keep on hand to answer such questions.
So let's use the following dbquery to get the information we need:
And here's the result of that query: