~/ learn/ postgresql/ cards/ Writing functions
1 of 2

Create a SQL function line_total(qty int, price numeric) RETURNS numeric that returns qty * price, then call line_total(3, 10) as total.

Create a SQL function line_total(qty int, price numeric) RETURNS numeric that returns qty * price, then call line_total(3, 10) as total.

Answer

CREATE FUNCTION line_total(qty int, price numeric) RETURNS numeric AS SELECT qty * price LANGUAGE sql; SELECT line_total(3, 10) AS total;

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/7536430b-9534-4bb8-b3d0-0a36821e9d25/flashcard utf-8 LF