Conditional values

From SQLZOO
Revision as of 14:58, 17 July 2012 by Connor (Talk | contribs)

Jump to: navigation, search

Conditional values

schema:gisq

The SQL Standard is the CASE statement

 
 
SELECT title, 
       score,
       IIF(score>8.5,'Excellent','OK')
   FROM movie
   WHERE 10>id
SELECT title, score,
  CASE
    WHEN score>8.5 THEN 'Excellent'
    ELSE 'OK'
  END
FROM movie
WHERE 10>id
SELECT
   title, 
   score,
   CASE WHEN score>8.5 THEN 'Excellent'
        ELSE 'OK'
   END
   FROM gisq.movie
   WHERE 10>id
SELECT
   title, 
   score,
   CASE WHEN score>8.5 THEN 'Excellent'
        ELSE 'OK'
   END
   FROM gisq.movie
   WHERE 10>id
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense