add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE Room (
room_id INTEGER PRIMARY KEY,
room_name TEXT UNIQUE NOT NULL
);
CREATE TABLE Item (
item_id INTEGER PRIMARY KEY,
room_id INTEGER,
item_name TEXT,
FOREIGN KEY (room_id) REFERENCES Room (room_id) ON UPDATE RESTRICT ON DELETE RESTRICT
);
INSERT INTO Room(room_name) VALUES ('Living Room');
WITH cte(item_name) AS (VALUES ('Chair'), ('TV'), ('Carpet'))
INSERT INTO Item (room_id, item_name)
SELECT r.room_id, c.item_name
FROM Room r CROSS JOIN cte c
WHERE r.room_name = 'Living Room';
SELECT * FROM Item;
item_id room_id item_name
1 1 Chair
2 1 TV
3 1 Carpet