Learning machine learning? Try my machine learning flashcards or Machine Learning with Python Cookbook.
Delete Table With Views
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
weapon varchar(255)
)
Insert Rows
-- Insert into the table adventurers
INSERT INTO adventurers (name, age, race, weapon)
VALUES ('Fjoak Doom-Wife', 28, 'Human', 'Axe'),
('Alooneric Cortte', 29, 'Human', 'Bow'),
('Piperel Ramsay', 35, 'Elf', 'Bow'),
('Casimir Yardley', 14, 'Elf', 'Bow')
Create View
-- Create view called elves containing
CREATE VIEW elves AS (
-- Select all rows from adventurers table
SELECT * FROM adventurers
-- Where the race is elf
WHERE race = 'Elf'
)
Delete Table
-- Delete table and dependent views
DROP TABLE adventurers CASCADE