~/ learn/ postgresql/ cards/ Numbers, rounding & casting
1 of 2

Show each title, its price, the price rounded to whole dollars (as rounded), and the price cast to an integer (as as_int).

Show each title, its price, the price rounded to whole dollars (as rounded), and the price cast to an integer (as as_int).

Answer

SELECT title, price, round(price) AS rounded, price::int AS as_int FROM books;

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/7b7cfc95-2de4-4a3f-a169-d9d0c457a60a/flashcard utf-8 LF