~/ learn/ postgresql/ cards/ Designing Schemas: DDL & Constraints
1 of 8

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/a7cd4de9-567c-4f04-8574-1916d90c020f/flashcard utf-8 LF