Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: Create table

Create the following schema

CREATE TABLE node (
    id      INTEGER PRIMARY KEY,
    name    VARCHAR(100)
);

CREATE TABLE interface (
    id       INTEGER PRIMARY KEY,
    node_id  INTEGER NOT NULL,
    ipv4     VARCHAR(15) UNIQUE,
    ipv6     VARCHAR(80) UNIQUE,
    FOREIGN KEY (node_id) REFERENCES node(id)
);

CREATE TABLE connection (
    a        INTEGER NOT NULL,
    b        INTEGER NOT NULL,
    FOREIGN KEY (a) REFERENCES interface(id),
    FOREIGN KEY (b) REFERENCES interface(id)
);

Insert a few data items. Write a few select statements.