Accessibility
 
Home / Developer Center / ColdFusion Developer Center /

ColdFusion Article

Ben Forta

Ben Forta
Senior Product Evangelist for ColdFusion

Author of The Macromedia ColdFusion MX Web Application Construction Kit

ColdFusion MX Web Application Construction Kit
 
ColdFusion MX Web Application Construction Kit:  databases and SQL


Ben Forta wrote the ColdFusion MX Web Application Construction Kit for anyone who wants to create cutting-edge, web-based applications. This book teaches you the fundamentals of using ColdFusion MX, databases, SQL, and much more.

Below you'll find Chapters 2, 5, and 6, which focus on databases and SQL. You can download these below. We've also excerpted from them and provided chapter outlines.

Download Chapters 2, 5, and 6 from ColdFusion MX Web Application Construction Kit:

Download Excerpt
Chapter 2: Building the Databases (348K) Read
Chapter 5: Introducing SQL (212K) Read
Chapter 6: SQL Data Manipulation (125K) Read

Chapter 2: Building the Databases
"You have just been assigned a project. You must create and maintain a list of all the movies produced by your employer—Orange Whip Studios. What do you use to maintain this list? Your first thought might be to use a word processor. You could create the list, one movie per line,and manually insert each movie's name so the list is alphabetical and usable. Your word processor provides you with sophisticated document-editing capabilities, so adding, removing, or updating movies is no more complicated than editing any other document.

"And then, just as you think you have the entire process worked out, your face pales and you freeze. What if someone else wants the list sorted by rating? And then,what if yet another department needs the list sorted in some other way? You panic, break out in a sweat, and tell yourself, 'There must be a better way!'

"This example is a bit extreme,but the truth is that a better way really does exist.You need to use a database."

Database Fundamentals
  Databases: A Definition
  Where Are Databases Used?
  Clarification of Database-Related Terms
  Data Types
Using a Database
  A Database Primer
Understanding Relational Databases
  Primary and Foreign Keys
  Different Kinds of Relationships
  Multitable Relationships
  Indexes
  Using Indexes
  Indexing on More than One Column
Understanding the Various Types of Database Applications
  Shared-File—Based Databases
  Client/Server—Based Databases
  Which Database Product to Use
Building the Orange Whip Studios (OWS) Database Tables
  The Films Table
  The FilmsDirectors Table
  The Actors Table
  The FilmsActors Table
  The FilmsRatings Table
  The UserRoles Table
  The Contacts Table
  The Merchandise Table
  The MerchandiseOrders Table
  The MerchandiseOrdersItems Table

Chapter 5: Introducing SQL
"SQL, pronounced sequel or S-Q-L , is an acronym for Structured Query Language. SQL is a language you use to access and manipulate data in a relational database. It is designed to be both easy to learn and extremely powerful,and its mass acceptance by so many database vendors proves that it has succeeded in both.

"Before you panic at the thought of learning a new language, let me reassure you that SQL really is easy to learn.In fact,you need to learn only four statements to be able to perform almost all the data manipulation you will need on a regular basis. Table 5.1 lists these statements."

Understanding Data Sources
Preparing to Write SQL Queries
Creating Queries
Sorting Query Results
Filtering Data
  Filtering on a Single Column
  Filtering on Multiple Columns
  The AND and OR Operators
  Evaluation Precedence
  WHERE Conditions

Chapter 6: SQL Data Manipulation
"Chapter 5, 'Introducing SQL,' introduced data drivers, data sources, SQL, and data retrieval (using the SELECT statement). You'll probably find that you spend far more time retrieving data than you do inserting, updating, or deleting data (which is why we concentrated on SELECT first)."

Adding Data
  Using the INSERT Statement
  Understanding INSERT
Modifying Data
  Understanding UPDATE
  Making Global Updates
Deleting Data
 

About the author
Ben Forta is the Macromedia Senior Product Evangelist for ColdFusion. Ben has two decades of experience in the computer industry, and is a much sought after speaker and lecturer. Ben is the author of the popular ColdFusion MX Web Application Construction Kit, and its sequel Advanced ColdFusion MX Application Development, as well as books on SQL, JSP (JavaServer Pages), WAP, and other technologies.

Macromedia Press
Expand your product knowledge with hands-on tutorials and comprehensive guides.  Whether you are  beginner, seasoned professional, designer or developer, Macromedia Press has the book for you. Search through titles today at: http://www.macromedia.com/go/books/