Table of Contents

Search

  1. About the Data Vault SQL Reference
  2. Introduction to SQL Reference for Informatica Data Vault
  3. Date and Time Arithmetic
  4. WHERE Clauses
  5. UNION Operator
  6. Parameterized Query
  7. Functions

Data Vault SQL Reference

Data Vault SQL Reference

Example of a Simple CASE

Example of a Simple CASE

SELECT lastname, CASE dept WHEN 'A' THEN 'Administration' WHEN 'D' THEN 'Development' WHEN 'Q' THEN 'Quality Assurance' WHEN 'T' THEN 'Technical Writing' ELSE '(unknown department)' END FROM employees;
In this example, the
employees
table is searched for employee last name and department. But instead of returning the single character that represents a department, a CASE statement is set up to return the full (or default) department name. If the
dept
value is ‘A’, the string ‘Administration’ is returned; if the
dept
value is ‘D’, ‘Development’ is returned; and so on. If the
dept
value matches none of the single characters tested in the CASE statement, the default string ‘(unknown department)’ is returned instead.

0 COMMENTS

We’d like to hear from you!