SQL/MP Query Guide

Contents
HP NonStop SQL/MP Query Guide524488-003
viii
Examples (continued)
Examples (continued)
Example 1-6. SELECT Statement With WHERE Clause 1-9
Example 1-7. SELECT Statement With HAVING Clause 1-9
Example 1-8. Sample Tables for Predicate Examples 1-31
Example 1-9. Sample Tables for Join Examples 1-54
Example 1-10. Sample Tables For Hierarchical Relationship Examples 1-57
Example 6-1. Simple Query 6-4
Example 6-2. DISPLAY STATISTICS for Simple Query 6-4
Example 6-3. Simple Query With ORDER BY 6-6
Example 6-4. DISPLAY STATISTICS for Simple Query With ORDER BY 6-6
Example 6-5. EXPLAIN Plan for Simple Query With ORDER BY 6-10
Example 6-6. EXPLAIN Plan for Simple Query Without ORDER BY 6-11
Example 6-7. EXPLAIN Plan for Simple SELECT 6-17
Example 6-8. EXPLAIN Plan Choosing Primary Access 6-18
Example 6-9. EXPLAIN Plan Choosing Index-Only Access 6-20
Example 6-10. EXPLAIN Plan for Lower-Bound Predicate 6-21
Example 6-11. EXPLAIN Plan for Lower and Upper Bounded Predicates 6-22
Example 6-12. EXPLAIN Plan for Key Predicates 6-23
Example 6-13. EXPLAIN Plan for SELECT DISTINCT 6-24
Example 6-14. EXPLAIN Plan for SELECT With ORDER BY 6-25
Example 6-15. EXPLAIN Plan for SELECT With GROUP BY Using a Serial
Plan 6-26
Example 6-16. EXPLAIN Plan for SELECT With GROUP BY Using a Parallel
Plan 6-28
Example 6-17. EXPLAIN Plan for Noncorrelated Subquery 6-30
Example 6-18. EXPLAIN Plan for Correlated Subquery 6-31
Example 6-19. EXPLAIN Plan for CASE With Multiple Conditions 6-33
Example 6-20.
EXPLAIN Plan for CASE With Aggregates 6-34
Example 6-21.
EXPLAIN Plan for CASE for Finding the Highest Value in a
Row 6-35
Example 6-22. EXPLAIN Plan for Converting Long, Narrow Tables Into Short, Wide
Ones 6-37
Example 6-23. EXPLAIN Plan for Ignoring the Largest and Smallest Values in a
Set 6-38
Example 6-24. EXPLAIN Plan for SUBSTRING 6-40
Example 6-25. EXPLAIN Plan for TRIM and CHAR_LENGTH 6-41
Example 6-26. EXPLAIN Plan for MDAM With OR and Equality Predicate on Second
Key Column 6-42
Example 6-27. EXPLAIN Plan for MDAM With Missing First Key Column 6-43
Example 6-28. EXPLAIN Plan for MDAM With IN List on Key Column 6-44