~/ learn/ postgresql/ cards/ Views
1 of 2

Create a view in_stock of books with stock > 0 (title, genre, stock), then count its rows. Column: n.

Create a view in_stock of books with stock > 0 (title, genre, stock), then count its rows. Column: n.

Answer

CREATE VIEW in_stock AS SELECT title, genre, stock FROM books WHERE stock > 0; SELECT count(*) AS n FROM in_stock;

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/3c397614-a11c-4455-bb83-30c3bb83d27e/flashcard utf-8 LF