HomeBlogLearn

SQL Tutorial

This page is under construction! In the meantime, you can still learn SQL by checking out the below videos.

If you have problems with the caching of PHP files, meaning the changes don't update in the browser right away when you change the php code, check out the answer by Saqib Omer.

Course Files:

This link provides all of the sql code we use throughout the course. If you have a typo you can check to see how your code compares with mine.

Course Files Link

** See code below video **

sql.txt

CREATE TABLE pets (
pet_id INT NOT NULL AUTO_INCREMENT,
pet_name VARCHAR(20) NOT NULL,
class VARCHAR(30),
age TINYINT,
family VARCHAR(30),
owner VARCHAR(30),
owner_gender VARCHAR(30),
PRIMARY KEY (pet_id)
);

INSERT INTO pets (pet_name, class, age, family, owner, owner_gender)
VALUES
("PJ", "Mammal", 15, "Dog", "John", "Male"),
("Buffy", "Mammal", 14, "Dog", "John", "Male"),
("Pixie", "Mammal", 8, "Cat", "Faith", "Female"),
("Charlie", "Mammal", 7, "Cat", "Judy", "Female"),
("Scooter", "Mammal", 10, "Squirrel", "Judy", "Female"),
("Smoke", "Bird", 4, "Parrot", "Alex", "none ya bizness"),
("Butch", "Reptile", 2, "Iguana", "Allison", "Female"),
("Rex", "Plant", 8, "Venus Flytrap", "Lucy", "Female"),
("Snowflake", "Amphibian", 23, "Salamander", "Faith", "Female"),
("Spot", "Arthropod", 4, "Black widow", "Mary", "Female"),
("Daisy", "Plant", 2, "Orchid", "Mary", "none ya bizness"),
("Squawk", "Bird", 9, "Hawk", "Giovanni", "Male"),
("Skeeter", "Reptile", 3, "Snake", "John", "Male"),
("Moonlight", "Mammal", 6, "Dog", "John", "Male"),
("Sunshine", "Fish", 1, "Piranha", "Mary", "Female"),
("Sandy", "Fish", 1, "Koi", "Allison", "Female"),
("Wags", "Mammal", 2, "Dog", "Alex", "Male"),
("Willy", "Amphibian", 9, "Frog", "Faith", "Female"),
("Tank", "Bird", 7, "Eagle", "Kate", "Female"),
("Ollie", "reptile", 14, "Dragon", "Judy", "Female"),
("Coco", "Bird", 11, "Parakeet", "Mary", "Female"),
("Luna", "Arthropod", 2, "Scorpion", "Giovanni", "Male"),
("Molly", "Mammal", 5, "Whale", "Mary", "Female"),
("Milly", "Arthropod", 4, "Grasshopper", "Edwina", "Female"),
("Simba", "Mammal", 8, "Cat", "Mary", "Female"),
("Jaws", "Fish", 13, "Barracuda", "Chris", "Male"),
("Yoshi", "Reptile", 4, "Dragon", "Zena", "Female"),
("Rango", "Amphibian", 7, "Frog", "Jason", "Male"),
("Pringle", "Mammal", 13, "Dolphin", "Caroline", "Female"),
("Lizzie", "Reptile", 3, "Lizard", "Curtis", "Male"),
("Norbert", "Bird", 7, "Magpie", "Owen", "Male"),
("Godzilla", "Reptile", 20, "Dragon", "Caroline", "Female"),
("Blue", "Mammal", 40, "Whale", "Thomas", "Male"),
("Blizzard", "Plant", 6, "Orchid", "Sreehari", "Male"),
("Spinner", "Mammal", 5, "Dolphin", "Sreehari", "Male"),
("Charmander", "Reptile", 2, "Lizard", "Jason", "Male")

Note: This tutorial needs some minor corrections, but you'll still need to go through this tutorial in order to understand the next tutorials. I'll make the adjustments when I can.