~/ 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/4475ec21-caf0-4332-98d2-9ce971aac276/flashcard utf-8 LF