SQL III-8

Card Set Information

Author:
dau108
ID:
145532
Filename:
SQL III-8
Updated:
2012-04-04 10:44:50
Tags:
SQL III
Folders:

Description:
SQL III-8
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user dau108 on FreezingBlue Flashcards. What would you like to do?


  1. Using advanced SQL value expressions
    • 􏱦 Using the CASE conditional expressions
    • 􏱦 Converting a data item from one data type to another
    • 􏱦 Saving data entry time by using row value expressions
  2. CASE conditional expression
    SQL has a CASE statement and a CASE expression. A CASE expression is only part of a statement — not a statement in its own right. In SQL, you can place a CASE expression almost anywhere a value is legal. At run time, a CASE expression evaluates to a value. SQL’s CASE statement doesn’t evaluate to a value; rather, it executes a block of statements.

    You can use the CASE expression in the following two ways:

    • 􏰏 Use the expression with search conditions. CASE searches for rows in a table where specified conditions are True. If CASE finds a search condition to be True for a table row, the statement containing the CASE expression
    • makes a specified change to that row.

    􏰏 Use the expression to compare a table field to a specified value. The outcome of the statement containing the CASE expression depends on which of several specified values in the table field is equal to each table row.
  3. using CASE with search conditions
  4. CASE
    • WHEN condition1 THEN result1
    • WHEN condition2 THEN result2
    • ...
    • WHEN conditionn THEN resultn
    • ELSE resultx
    • END
  5. updating values based on a condition
  6. avoiding conditions that cause error
  7. using case with values
  8. a special CASE- NULLIF
    • UPDATE FLIGHT
    • SET RefuelStop = CASE
    • WHEN RefuelStop = ‘San Jose’
    • THEN NULL
    • ELSE RefuelStop
    • END ;
  9. UPDATE FLIGHT
    SET RefuelStop = NULLIF(RefuelStop, ‘San Jose’) ;

What would you like to do?

Home > Flashcards > Print Preview