~/ 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/0e49a667-5da4-4607-b77c-d364578918bc/flashcard utf-8 LF