This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE Users ( | |
user_id INT PRIMARY KEY AUTO_INCREMENT, | |
first_name VARCHAR(50) NOT NULL, | |
last_name VARCHAR(50) NOT NULL, | |
username VARCHAR(50) UNIQUE NOT NULL, | |
password VARCHAR(255) NOT NULL | |
); | |
CREATE TABLE Schools ( | |
school_id INT PRIMARY KEY AUTO_INCREMENT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create Team table | |
CREATE TABLE Team ( | |
team_id INT PRIMARY KEY AUTO_INCREMENT, | |
name VARCHAR(100) NOT NULL, | |
country VARCHAR(100) NOT NULL | |
); | |
-- Create Car table | |
CREATE TABLE Car ( | |
car_number INT PRIMARY KEY, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. What are the names of countries with population greater than 8 million? | |
SELECT Name | |
FROM country | |
WHERE Population > 8000000; | |
-- 2. What are the names of countries that have “land” in their names? | |
SELECT Name | |
FROM country | |
WHERE Name LIKE "%land%"; |