|
Macromedia Dreamweaver 8 Advanced for Windows and Macintosh. Visual Quickpro Guide Authors: Dykes L. Published year: 2004 Pages: 49-50/129 |
Filtering DataYou can extract a subset of the data from a SELECT statement by adding a WHERE clause. For example, if you want to retrieve data only on a certain set of members in the travel club, rather than all the members , you specify the criteria for that set by adding a WHERE clause to your SELECT statement. In the following task, you'll select the first_name and last_name fields from the members table and then filter that data by selecting only those members whose id is less than a certain number. You'll then filter the data by selecting only those members whose id is within a certain range of numbers . Last, you'll add an IS NULL clause to a WHERE clause to check for missing data in the flight_time field in the flightprefs table. To filter data using SQL:
|
Joining TablesYou can use SQL to create complex queries that select data from multiple tables in a database. A join operation combines tables so that it can extract related data. However, there must be a relationship between the tables for a join operation to work. The flightprefs and members tables have a relationship between their primary keys (both of them use id as their primary key), so we can combine data from both tables. In the next task, you'll combine information from the members table (last_name, first_name) and the flightprefs table (flight_time, seat_location) by joining the two tables in a SELECT statement. In this way, you can extract a set of data that combines the members' names with their preferences for flight times and seat locations. To join tables using SQL:
|
|
Macromedia Dreamweaver 8 Advanced for Windows and Macintosh. Visual Quickpro Guide Authors: Dykes L. Published year: 2004 Pages: 49-50/129 |
![]() Macromedia Dreamweaver 8: Training from the Source | ![]() Macromedia Dreamweaver 8 for Windows & Macintosh (Visual QuickStart Guide) |