Create Table With Default Values

Create Table

-- Create table called adventurers
CREATE TABLE adventurers (
    -- string variable
    name varchar(255),
    -- integer variable
    age int,
    -- string variable
    race varchar(255),
    -- string variable with default value of 'no weapon'
    weapon varchar(255) DEFAULT 'no weapon'

Insert Row

-- Insert rows into the table adventurers
-- Notice we don't provide value for weapon column
INSERT INTO adventurers (name, age, race)
VALUES ('Piperel Ramsay', 35, 'Elf'),
       ('Casimir Yardley', 14, 'Elf')

Retrieve Rows

-- Retrieve all rows from table
SELECT * FROM adventurers
Piperel Ramsay35Elfno weapon
Casimir Yardley14Elfno weapon