🤷♀️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT SUM(price), | |
CASE | |
WHEN name = ANY (ARRAY ['Airbus A333-300', 'Airbus A380-800']) THEN 'airplane' | |
WHEN name = ANY (ARRAY ['Volkswagen Golf', 'Porsche Cayenne']) THEN 'car' | |
ELSE null | |
END AS type | |
FROM vehicles | |
GROUP BY vehicle_type; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, | |
CASE | |
WHEN name = ANY(ARRAY['Airbus A333-300', 'Airbus A380-800']) THEN 'airplane' | |
WHEN name = ANY(ARRAY['Volkswagen Golf', 'Porsche Cayenne']) THEN 'car' | |
ELSE null | |
END AS type | |
FROM vehicles; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, | |
CASE | |
WHEN name = 'Airbus A333-300' THEN 'airplane' | |
WHEN name = 'Airbus A380-800' THEN 'airplane' | |
WHEN name = 'Volkswagen Golf' THEN 'car' | |
WHEN name = 'Porsche Cayenne' THEN 'car' | |
ELSE null | |
END AS type | |
FROM vehicles; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM vehicles | |
WHERE name = ANY (ARRAY['Airbus A333-300', 'Airbus A380-800']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARRAY['Airbus A333-300', 'Airbus A380-800'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VALUES ('Airbus A333-300'), ('Airbus A380-800') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Airbus A333-300", | |
"type": "airplane" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Airbus A333-300", | |
"type": "airplane" | |
}, | |
{ | |
"name": "Volkswagen Golf", | |
"type": "car" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const vehicles = [ | |
"Airbus A333-300", | |
"Volkswagen Golf", | |
"Porsche Cayenne", | |
"Airbus A380-800" | |
]; | |
const vehiclesWithTypes = vehicles.map(vehicle => { | |
switch (vehicle) { | |
case "Airbus A380-800": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const booleanValue = true; | |
const baseFormat = { | |
consumer_vat: consumerVat | |
}; | |
const format = { | |
a: true, | |
...(booleanValue && baseFormat) | |
}; |