Create Table Of Adventurers
-- Create table called adventurers
CREATE TABLE adventurers (
-- string variable
name varchar(255),
-- integer variable
age int,
-- string variable
race varchar(255)
)
Insert Rows
-- Insert into the table adventurers
INSERT INTO adventurers (name, age, race)
VALUES ('Fjoak Doom-Wife', 28, 'Human'),
('Alooneric Cortte', 29, 'Elf'),
('Piperel Ramsay', 35, 'Elf'),
('Casimir Yardley', 14, 'Elf')
Apply Addition To Column
-- Apply operation
UPDATE adventurers SET age = age + 10
View Table
-- Retrieve data
SELECT * FROM adventurers
name | age | race |
Fjoak Doom-Wife | 38 | Human |
Alooneric Cortte | 39 | Elf |
Piperel Ramsay | 45 | Elf |
Casimir Yardley | 24 | Elf |
Apply Substraction To Column
-- Apply operation
UPDATE adventurers SET age = age - 10
View Table
-- Retrieve data
SELECT * FROM adventurers
name | age | race |
Fjoak Doom-Wife | 28 | Human |
Alooneric Cortte | 29 | Elf |
Piperel Ramsay | 35 | Elf |
Casimir Yardley | 14 | Elf |
Apply Multiplication To Column
-- Apply operation
UPDATE adventurers SET age = age * 10
View Table
-- Retrieve data
SELECT * FROM adventurers
name | age | race |
Fjoak Doom-Wife | 280 | Human |
Alooneric Cortte | 290 | Elf |
Piperel Ramsay | 350 | Elf |
Casimir Yardley | 140 | Elf |
Apply Division To Column
-- Apply operation
UPDATE adventurers SET age = age / 10
View Table
-- Retrieve data
SELECT * FROM adventurers
name | age | race |
Fjoak Doom-Wife | 28 | Human |
Alooneric Cortte | 29 | Elf |
Piperel Ramsay | 35 | Elf |
Casimir Yardley | 14 | Elf |
Apply Modulo To Column
-- Apply operation
UPDATE adventurers SET age = age % 10
View Table
-- Retrieve data
SELECT * FROM adventurers
name | age | race |
Fjoak Doom-Wife | 8 | Human |
Alooneric Cortte | 9 | Elf |
Piperel Ramsay | 5 | Elf |
Casimir Yardley | 4 | Elf |