Use case expression to represent data in a manner that is more meaningful, for example, to display a phrase rather than a binary (1, 0) setting.
For example, the pubs2 database stores a 1 or a 0 in the contract column of the titles table to indicate the status of the book’s contract. However, in your application code or for user interaction, you may prefer to use the words “Contract” or “No Contract” to indicate the status of the book. To select the type from the titles table using the alternative representation:
select title, "Contract Status" = case when contract = 1 then "Contract" when contract = 0 then "No Contract" end from titles
title Contract Status ----- --------------- The Busy Executive’s Database Guide Contract Cooking with Computers: Surreptitio Contract You Can Combat Computer Stress! Contract . . . The Psychology of Computer Cooking No Contract . . . Fifty Years in Buckingham Palace Contract Sushi, Anyone? Contract (18 rows affected)