This example decodes the value warehouse_id. If warehouse_id is 1, then the function returns 'Southlake'; if warehouse_id is 2, then it returns 'San Francisco'; and so forth. If warehouse_id is not 1, 2, 3, or 4, then the function returns 'Non domestic'.
Answer
SELECT product_id,
DECODE (warehouse_id,
1, 'Southlake',
2, 'San Francisco',
3, 'New Jersey',
4, 'Seattle', 'Non domestic') "Location of inventory"
FROM inventories WHERE product_id < 1775;
Tags
#decode
Question
This example decodes the value warehouse_id. If warehouse_id is 1, then the function returns 'Southlake'; if warehouse_id is 2, then it returns 'San Francisco'; and so forth. If warehouse_id is not 1, 2, 3, or 4, then the function returns 'Non domestic'.
Answer
?
Tags
#decode
Question
This example decodes the value warehouse_id. If warehouse_id is 1, then the function returns 'Southlake'; if warehouse_id is 2, then it returns 'San Francisco'; and so forth. If warehouse_id is not 1, 2, 3, or 4, then the function returns 'Non domestic'.
Answer
SELECT product_id,
DECODE (warehouse_id,
1, 'Southlake',
2, 'San Francisco',
3, 'New Jersey',
4, 'Seattle', 'Non domestic') "Location of inventory"
FROM inventories WHERE product_id < 1775;
If you want to change selection, open document below and click on "Move attachment"
DECODE al, "Floating-Point Numbers" for information on floating-point comparison semantics, and "Implicit and Explicit Data Conversion" for information on the drawbacks of implicit conversion Examples <span>This example decodes the value warehouse_id. If warehouse_id is 1, then the function returns 'Southlake'; if warehouse_id is 2, then it returns 'San Francisco'; and so forth. If warehouse_id is not 1, 2, 3, or 4, then the function returns 'Non domestic'. SELECT product_id, DECODE (warehouse_id, 1, 'Southlake', 2, 'San Francisco', 3, 'New Jersey', 4, 'Seattle', 'Non domestic') "Location of inventory" FROM inventories WHERE product_id < 1775; Scripting on this page enhances content navigation, but does not change the content in any way. <span>
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.