Created
November 10, 2018 02:48
-
-
Save tuankiet65/36fd7cf979cf6a1973e516e130316a26 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
CREATE TABLE teams ( | |
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, | |
team TEXT NOT NULL, | |
wins INT NOT NULL, | |
losses INT NOT NULL | |
); | |
INSERT INTO teams (team, wins, losses) VALUES ("Anteaters", 10, 2); | |
INSERT INTO teams (team, wins, losses) VALUES ("Byrds", 8, 0); | |
INSERT INTO teams (team, wins, losses) VALUES ("Monkeys", 6, 6); | |
INSERT INTO teams (team, wins, losses) VALUES ("Admirals", 10, 2); | |
INSERT INTO teams (team, wins, losses) VALUES ("Sapsuckers", 5, 7); | |
-- Question 3 | |
SELECT * FROM teams ORDER BY wins DESC; | |
-- Question 4 | |
SELECT * FROM teams ORDER BY wins DESC, team; | |
-- Question 5 | |
INSERT INTO teams (team, wins, losses) VALUES ("Bears", 3, 9); | |
-- Question 6 | |
INSERT INTO teams (team, wins, losses) VALUES ("Lions", 9, 3); | |
-- Question 7 | |
SELECT * FROM teams; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment