A Quick SQL Primer
Before we go any further, a quick primer on SQL is in order. If you are already an SQL guru, feel free to skip this section. If, however, you are new to SQL, this section quickly covers the basic elements that go into creating an SQL statement. This primer is by no means a substitute for a thorough lesson on SQL. You may want to consult additional SQL references before proceeding, as a good understanding of SQL is an essential element in ColdFusion application design. One of the surest ways to bottleneck your applications is with poorly written SQL. Additionally, SQL is implemented in slightly different ways across various RDBMS platforms. For this reason, it is important to consult the documentation specific to your database to understand these differences.
With the disclaimer out of the
way, let’s move on and look at the elements that go into
creating an SQL statement for use in a CFQUERY
tag. If you don’t completely understand everything we are about
to cover, don’t worry. Every aspect (and more) of the SQL we
cover in the primer is covered in more detail throughout this and the
next chapter.
Most database transactions in a web application can be grouped into
one of four categories: selecting, inserting, updating, and deleting
data. Not surprisingly, there are four commands in SQL that handle
theses tasks. They are SELECT,
INSERT, UPDATE, and
DELETE, respectively:
-
SELECT Retrieves data from a data source
-
INSERT Inserts new data in a data source
-
UPDATE ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access