~/ learn/ postgresql/ cards/ Data types & constraints
1 of 2

Create a table ratings(book_id int NOT NULL, stars int NOT NULL CHECK (stars BETWEEN 1 AND 5)), insert (1, 5), and RETURN all columns.

Create a table ratings(book_id int NOT NULL, stars int NOT NULL CHECK (stars BETWEEN 1 AND 5)), insert (1, 5), and RETURN all columns.

Answer

CREATE TABLE ratings ( book_id int NOT NULL, stars int NOT NULL CHECK (stars BETWEEN 1 AND 5) ); INSERT INTO ratings VALUES (1, 5) RETURNING *;

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/84e98985-67c4-4e04-b96f-f45e0246769d/flashcard utf-8 LF