Macromedia Dreamweaver 8 UNLEASHED Free Open Book

Macromedia Dreamweaver 8 UNLEASHED

Previous Page
Next Page

Subqueries

Sometimes it may not be possible to retrieve the results you need using a simple SELECT statement. At times, you might need to create a SELECT statement and compare the results to that of another statement. In that case, you would want to use subqueries. A subquery is a query nested inside another query. There are two types of subqueries you can use:

  • The IN operator

  • The embedded SELECT statement

The IN Operator

The IN operator is used in a SELECT statement primarily to specify a list of values to be used with a primary query. A classic example is if you wanted to find all your employees who lived in California and its border states such as Arizona, Nevada, and Oregon. You could write a SELECT statement using the IN operator to accomplish that:

SELECT * 
FROM Employees 
WHERE BillingShippingState IN ("Ca", "Az", "Nv", "Or")

This statement effectively returns all the employees who live in the states of California, Arizona, Nevada, and Oregon.

The Embedded SELECT Statement

An embedded SELECT statement is used when you want to perform a secondary query within the WHERE clause of a primary query. Suppose that you wanted to see a list of employees who have completed orders for the week. If that were the case, your query might look like this:

SELECT * 
FROM Employees
WHERE EmployeeID IN 
        (SELECT DISTINCT EmployeeID
        FROM Orders)

Previous Page
Next Page
Index: [SYMBOL][A][B][C][D][E][F][G][H][I][J][L][M][N][O][P][Q][R][S][T][U][V][W][X][Z]


     Main Menu
Macromedia Dreamweaver 8 UNLEASHED
Table of Contents
Copyright
About the Author
Acknowledgments
We Want to Hear from You!
Reader Services
Bonus Content
Introduction
Part I. Getting Up to Speed with Dreamweaver 8
Part II. Static Web Page Development
Part III. Team Collaboration and Task Automation
Part IV. Incorporating Multimedia and Animation
Part V. Dynamic Web Page Creation
Chapter 21. Introduction to Web Applications
Chapter 22. Working with Server-Side Technologies
Chapter 23. A Database Primer
Chapter 24. A SQL Primer
The Structured Query Language
Basic SQL
Expressions
Operators
Functions
Joins
Subqueries
Using Access to Generate Queries
Using MySQL Maestro to Generate Queries
Summary
Part VI. Building Dynamic Web Pages
Part VII. Appendixes and Bonus Content on the Website
Index


More Books
PHP Hacks
Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
The Koran (Holy Qur'an)
Macromedia Flash 8 Bible
Search Engine Optimization for Dummies
YouTube Traffic
PHP 5 for Dummies
Harry Potter and The Chamber of Secrets
Harry Potter and the Sorcerer's Stone
The Pilgrim's Progress
Wireless Hacks
Flash Hacks. 100 Industrial-Strength Tips & Tools
PayPal Hacks. 100 Industrial-Strength Tips and Tools
Amazon Hacks
Pdf Hacks
The Da Vinci Code
Google Hacks
The Holy Bible
Windows XP For Dummies
Harry Potter and the Half-Blood Prince
Seo Book
Upgrading and Repairing Networks
Macromedia Dreamweaver 8 UNLEASHED
Windows XP Annoyances
Windows XP Hacks
Microsoft Windows XP Power Toolkit
Teach Yourself MS Office In 24Hours
iPod & iTunes Missing Manual
PC Hacks 100 Industrial-Strength Tips and Tools
PC Overclocking, Optimization, and Tuning - 2th Edition
PC Hardware In A Nutshell 3rd Edition
PC Hardware in a Nutshell, 2nd Edition
Upgrading and Repairing PCs
Google for Dummies
MySQL Cookbook
Teach Yourself Macromedia Flash 8 In 24 Hours
PHP CookBook
Sams Teach Yourself JavaScript in 24 Hours
PHP5 Manual
Free Games Paper Airplanes
500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele