├── 1. create-bakery-db.sql ├── 2.10 Aliasing.sql ├── 2.11 Case Statement.sql ├── 2.2 Basics of Querying.sql ├── 2.3 Select Statement.sql ├── 2.4 Where Statement - Comparison and Logical Operators.sql ├── 2.5 IN Operator.sql ├── 2.6 Between Operator.sql ├── 2.7 LIKE Operator.sql ├── 2.8 Order By.sql ├── 2.9 Limit.sql ├── 3.2 Using Group By.sql ├── 3.3 Aggregate Functions.sql ├── 3.4 Having vs Where.sql ├── 4.2 Inner Joins.sql ├── 4.3 Joining Multiple Tables.sql ├── 4.4 Joining on Multiple Conditions.sql ├── 4.5 Outer Joins.sql ├── 4.6 Self Join.sql ├── 4.7 Cross Joins.sql ├── 4.8 Unions.sql ├── 5.2 Subqueries.sql ├── 5.3 ANY and ALL.sql ├── 5.4 Subqueries in the FROM and SELECT Statement.sql ├── 6.2 Window Function Basics - OVER() and Partition By.sql ├── 6.3 Row_Number().sql ├── 6.4 Rank and Dense_Rank.sql ├── 6.5 Lag and Lead.sql └── README.md /1. create-bakery-db.sql: -------------------------------------------------------------------------------- 1 | 2 | DROP DATABASE IF EXISTS `bakery`; 3 | CREATE DATABASE `bakery`; 4 | USE `bakery`; 5 | 6 | CREATE TABLE `products` ( 7 | `product_id` int(11) NOT NULL AUTO_INCREMENT, 8 | `product_name` varchar(50) NOT NULL, 9 | `units_in_stock` int(11) NOT NULL, 10 | `sale_price` decimal(4,2) NOT NULL, 11 | PRIMARY KEY (`product_id`) 12 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 13 | INSERT INTO `products` VALUES (1001,'Chocolate Chip Cookie',200,1.50); 14 | INSERT INTO `products` VALUES (1002,'Banana Nut Muffin',180,2.50); 15 | INSERT INTO `products` VALUES (1003,'Croissant',70,1.75); 16 | INSERT INTO `products` VALUES (1004,'Cheese Danish',55,1.85); 17 | INSERT INTO `products` VALUES (1005,'Cannoli',112,2.25); 18 | INSERT INTO `products` VALUES (1006,'Sweet Bread Loaf',32,15.50); 19 | INSERT INTO `products` VALUES (1007,'Strawberry Macaron',98,2.00); 20 | INSERT INTO `products` VALUES (1008,'Coffee Cake',25,13.00); 21 | INSERT INTO `products` VALUES (1009,'Carrot Cake',15,14.50); 22 | INSERT INTO `products` VALUES (1010,'Chocolate Covered Doughnut',80,1.00); 23 | 24 | 25 | CREATE TABLE `suppliers` ( 26 | `supplier_id` smallint(6) NOT NULL AUTO_INCREMENT, 27 | `name` varchar(50) NOT NULL, 28 | PRIMARY KEY (`supplier_id`) 29 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 30 | INSERT INTO `suppliers` VALUES (1,'Bakery LLC'); 31 | INSERT INTO `suppliers` VALUES (2,'Goods 4 U'); 32 | INSERT INTO `suppliers` VALUES (3,'Savory Loaf Delivery Co.'); 33 | INSERT INTO `suppliers` VALUES (4,'Mrs. Yums'); 34 | INSERT INTO `suppliers` VALUES (5,'Grain to Table LLC'); 35 | 36 | 37 | CREATE TABLE `supplier_delivery_status` ( 38 | `order_status_id` tinyint(4) NOT NULL, 39 | `name` varchar(50) NOT NULL, 40 | PRIMARY KEY (`order_status_id`) 41 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 42 | INSERT INTO `supplier_delivery_status` VALUES (1,'Processed'); 43 | INSERT INTO `supplier_delivery_status` VALUES (2,'Shipped'); 44 | INSERT INTO `supplier_delivery_status` VALUES (3,'Delivered'); 45 | 46 | 47 | CREATE TABLE `ordered_items` ( 48 | `order_id` int(11) NOT NULL AUTO_INCREMENT, 49 | `product_id` int(11) NOT NULL, 50 | `status` tinyint(4) NOT NULL DEFAULT '1', 51 | `quantity` int(11) NOT NULL, 52 | `unit_price` decimal(4,2) NOT NULL, 53 | `shipped_date` date DEFAULT NULL, 54 | `shipper_id` smallint(6) DEFAULT NULL, 55 | PRIMARY KEY (`order_id`,`product_id`), 56 | KEY `fk_orders_items_order_idx` (`order_id`), 57 | KEY `fk_order_items_products_idx` (`product_id`), 58 | KEY `fk_orders_order_statuses_idx` (`status`), 59 | CONSTRAINT `fk_order_items_orders` FOREIGN KEY (`order_id`) REFERENCES `ordered_items` (`order_id`) ON UPDATE CASCADE, 60 | CONSTRAINT `fk_orders_order_statuses` FOREIGN KEY (`status`) REFERENCES `supplier_delivery_status` (`order_status_id`) ON UPDATE CASCADE, 61 | CONSTRAINT `fk_order_items_products` FOREIGN KEY (`product_id`) REFERENCES `products` (`product_id`) ON UPDATE CASCADE, 62 | CONSTRAINT `fk_orders_shippers` FOREIGN KEY (`shipper_id`) REFERENCES `suppliers` (`supplier_id`) ON UPDATE CASCADE 63 | 64 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 65 | INSERT INTO `ordered_items` VALUES (1,1004,1,53,0.35,'2021-08-15',1); 66 | INSERT INTO `ordered_items` VALUES (2,1001,2,73,0.29,'2022-03-21',2); 67 | INSERT INTO `ordered_items` VALUES (2,1004,3,10,0.35,'2022-02-07',5); 68 | INSERT INTO `ordered_items` VALUES (2,1006,2,63,5.28,'2021-06-09',4); 69 | INSERT INTO `ordered_items` VALUES (3,1003,1,21,0.50,'2021-09-06',1); 70 | INSERT INTO `ordered_items` VALUES (4,1003,2,85,0.50,'2022-06-22',3); 71 | INSERT INTO `ordered_items` VALUES (4,1010,3,42,0.39,'2021-05-13',4); 72 | INSERT INTO `ordered_items` VALUES (5,1002,1,100,1.89,'2022-02-03',2); 73 | INSERT INTO `ordered_items` VALUES (6,1001,2,35,0.29,'2021-11-06',3); 74 | INSERT INTO `ordered_items` VALUES (6,1002,2,54,1.89,'2022-12-23',5); 75 | INSERT INTO `ordered_items` VALUES (6,1003,3,10,0.50,'2022-04-05',1); 76 | INSERT INTO `ordered_items` VALUES (6,1005,3,55,0.47,'2021-05-22',2); 77 | INSERT INTO `ordered_items` VALUES (7,1003,3,12,0.50,'2022-06-26',1); 78 | INSERT INTO `ordered_items` VALUES (8,1005,2,70,0.47,'2021-09-21',5); 79 | INSERT INTO `ordered_items` VALUES (8,1008,2,96,8.59,'2022-11-10',3); 80 | INSERT INTO `ordered_items` VALUES (9,1006,3,43,5.28,'2022-10-15',1); 81 | INSERT INTO `ordered_items` VALUES (10,1001,1,33,0.29,'2022-01-06',1); 82 | INSERT INTO `ordered_items` VALUES (10,1009,3,23,4.28,'2022-07-23',1); 83 | 84 | 85 | CREATE TABLE `customers` ( 86 | `customer_id` int(11) NOT NULL AUTO_INCREMENT, 87 | `first_name` varchar(50) NOT NULL, 88 | `last_name` varchar(50) NOT NULL, 89 | `birth_date` date DEFAULT NULL, 90 | `phone` varchar(50) DEFAULT NULL, 91 | `address` varchar(50) NOT NULL, 92 | `city` varchar(50) NOT NULL, 93 | `state` char(2) NOT NULL, 94 | `total_money_spent` int(11) NOT NULL DEFAULT '0', 95 | PRIMARY KEY (`customer_id`) 96 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 97 | INSERT INTO `customers` VALUES (100101,'Kevin','Malone','1989-04-28','635-573-9754','1229 Main Street','Scranton','PA',11000); 98 | INSERT INTO `customers` VALUES (100102,'Charles','Xavier','1965-04-11','729-287-9456','123 North Hill Drive','Dallas','TX',947); 99 | INSERT INTO `customers` VALUES (100103,'Finley','Danish','1999-02-07','126-583-7856','432 Hilly Road','Austin','TX',534); 100 | INSERT INTO `customers` VALUES (100104,'Obi','Kenobi','1921-04-22','975-357-7663','101 Alpine Avenue','New York','NY',3567); 101 | INSERT INTO `customers` VALUES (100105,'Don','Draper','1948-11-07',NULL,'12 South Main Lane','San Francisco','CA',195); 102 | INSERT INTO `customers` VALUES (100106,'Frodo','Baggins','2001-09-04',NULL,'1 Pastery Lane','Chicago','IL',56); 103 | INSERT INTO `customers` VALUES (100107,'Michael','Scott','1978-08-20','235-357-3464','987 Croissant Street','Scranton','PA',2536); 104 | INSERT INTO `customers` VALUES (100108,'Maggie','Muffin','2001-07-06','906-485-1542','701 North Street','Sarasota','FL',1009); 105 | INSERT INTO `customers` VALUES (100109,'Kelly','Kapoor','1987-05-30','674-357-9151','62810 Julip Lane','Scranton','PA',540); 106 | INSERT INTO `customers` VALUES (100110,'Anakin','Skywalker','1934-10-15','346-458-3370','122 South Street','Charleston','SC',36); 107 | 108 | 109 | CREATE TABLE `customer_orders` ( 110 | `order_id` int(11) NOT NULL AUTO_INCREMENT, 111 | `customer_id` int(11) NOT NULL, 112 | `product_id` int(11) NOT NULL, 113 | `order_date` date NOT NULL, 114 | `order_total` decimal(4,2) NOT NULL, 115 | `tip` varchar(2000) DEFAULT NULL, 116 | PRIMARY KEY (`order_id`), 117 | KEY `fk_customers_orders__idx` (`customer_id`), 118 | KEY `fk_orders_shippers_idx` (`product_id`), 119 | CONSTRAINT `fk_orders_customers` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`customer_id`) ON UPDATE CASCADE, 120 | CONSTRAINT `fk_customer_orders` FOREIGN KEY (`product_id`) REFERENCES `products` (`product_id`) ON UPDATE CASCADE 121 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 122 | INSERT INTO `customer_orders` VALUES (1,100101,1001,'2020-01-30',26.24,2); 123 | INSERT INTO `customer_orders` VALUES (2,100110,1002,'2021-08-25',6.19,1); 124 | INSERT INTO `customer_orders` VALUES (3,100106,1005,'2022-12-12',3.87,0); 125 | INSERT INTO `customer_orders` VALUES (4,100103,1007,'2018-03-22',4.00,5); 126 | INSERT INTO `customer_orders` VALUES (5,100102,1003,'2017-08-25',9.97,10); 127 | INSERT INTO `customer_orders` VALUES (6,100108,1009,'2018-11-18',87.01,1); 128 | INSERT INTO `customer_orders` VALUES (7,100101,1001,'2022-09-20',2.45,5); 129 | INSERT INTO `customer_orders` VALUES (8,100104,1008,'2018-06-08',16.42,0); 130 | INSERT INTO `customer_orders` VALUES (9,100105,1007,'2019-07-05',8.11,1); 131 | INSERT INTO `customer_orders` VALUES (10,100106,1006,'2018-04-22',53.12,3); 132 | INSERT INTO `customer_orders` VALUES (11,100103,1001,'2019-11-18',27.01,1); 133 | INSERT INTO `customer_orders` VALUES (12,100101,1003,'2018-09-20',10.45,5); 134 | INSERT INTO `customer_orders` VALUES (13,100106,1008,'2020-06-08',90.42,0); 135 | INSERT INTO `customer_orders` VALUES (14,100102,1009,'2022-07-05',11.11,1); 136 | INSERT INTO `customer_orders` VALUES (15,100104,1006,'2020-04-22',24.12,3); 137 | 138 | 139 | 140 | CREATE TABLE `customer_orders_review` ( 141 | `order_id` int(11) NOT NULL AUTO_INCREMENT, 142 | `customer_id` int(11) NOT NULL, 143 | `product_id` int(11) NOT NULL, 144 | `order_date` date NOT NULL, 145 | `Rating 1-10` int(11) NOT NULL, 146 | PRIMARY KEY (`order_id`) 147 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 148 | INSERT INTO `customer_orders_review` VALUES (1,100101,1001,'2020-01-30',8); 149 | INSERT INTO `customer_orders_review` VALUES (2,100110,1002,'2021-08-25',5); 150 | INSERT INTO `customer_orders_review` VALUES (3,100111,1005,'2022-12-12',10); 151 | INSERT INTO `customer_orders_review` VALUES (4,100103,1007,'2081-03-22',7); 152 | INSERT INTO `customer_orders_review` VALUES (5,100102,1003,'2017-08-25',6); 153 | INSERT INTO `customer_orders_review` VALUES (7,100101,1001,'2022-09-20',8); 154 | INSERT INTO `customer_orders_review` VALUES (8,100104,1008,'2018-06-08',9); 155 | INSERT INTO `customer_orders_review` VALUES (9,100105,1007,'2019-07-05',6); 156 | INSERT INTO `customer_orders_review` VALUES (10,100106,1006,'2018-04-22',8); 157 | INSERT INTO `customer_orders_review` VALUES (11,100103,1001,'2019-11-18',6); 158 | INSERT INTO `customer_orders_review` VALUES (12,1001001,1003,'2018-09-20',9); 159 | INSERT INTO `customer_orders_review` VALUES (13,100106,1008,'2020-06-08',10); 160 | INSERT INTO `customer_orders_review` VALUES (14,100102,1009,'2023-07-05',8); 161 | INSERT INTO `customer_orders_review` VALUES (15,100104,1006,'2020-04-22',7); 162 | 163 | 164 | 165 | 166 | 167 | CREATE TABLE `employees` ( 168 | `employee_id` int(11) NOT NULL AUTO_INCREMENT, 169 | `first_name` varchar(50) NOT NULL, 170 | `last_name` varchar(50) NOT NULL, 171 | `department` varchar(50) NOT NULL, 172 | `title` varchar(50) NOT NULL, 173 | `salary` int(11) NOT NULL, 174 | PRIMARY KEY (`employee_id`) 175 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 176 | INSERT INTO `employees` VALUES (1,'Christine','Freberg','Bakery','Lead Baker', 70000); 177 | INSERT INTO `employees` VALUES (2,'Dwight','Schrute','Bakery','Assistant to the Lead Baker', 45000); 178 | INSERT INTO `employees` VALUES (3,'Tom','Haveford','Bakery','Chocolatier', 45000); 179 | INSERT INTO `employees` VALUES (4,'Ann','Perkins','Bakery','Bakery Clerk', 30000); 180 | INSERT INTO `employees` VALUES (5,'Carl','Lorthner','Bakery','Dough Maker', 40000); 181 | INSERT INTO `employees` VALUES (6,'Ron','Swanson','Marketing','Director of Marketing', 75000); 182 | INSERT INTO `employees` VALUES (7,'Troy','Barnes','Marketing','Lead Marketer', 60000); 183 | INSERT INTO `employees` VALUES (8,'Jeff','Winger','Marketing','Marketing Analyst', 60000); 184 | INSERT INTO `employees` VALUES (9,'Annie','Edison','Marketing','Social Media Marketer', 65000); 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /2.10 Aliasing.sql: -------------------------------------------------------------------------------- 1 | # Aliasing 2 | 3 | 4 | 5 | SELECT *, p.units_in_stock * p.sale_price 'Max_Profits' 6 | FROM products p 7 | ; 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /2.11 Case Statement.sql: -------------------------------------------------------------------------------- 1 | # CASE Statements 2 | 3 | 4 | SELECT *, 5 | CASE 6 | WHEN units_in_stock < 20 THEN 'ORDER MORE NOW!!' 7 | WHEN units_in_stock > 50 THEN 'Check back on Friday.' 8 | WHEN units_in_stock > 100 THEN 'All good my friend' 9 | END AS Label 10 | FROM products 11 | ; 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | # Practice Question 47 | # Using the table customer_orders, if a customer tipped 2 dollars or more give them a 10% discount. Make this a new column called "discounted total" to compare to the original order amount. 48 | 49 | SELECT *, 50 | CASE 51 | WHEN tip >= 2 THEN order_total * .9 52 | END AS 'discounted total' 53 | FROM customer_orders; 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /2.2 Basics of Querying.sql: -------------------------------------------------------------------------------- 1 | # SQL Basics 2 | 3 | 4 | 5 | SELECT * 6 | FROM customers; 7 | 8 | 9 | 10 | SELECT * 11 | FROM customers 12 | WHERE first_name = 'Frodo' 13 | ; 14 | 15 | 16 | SELECT * 17 | FROM customers 18 | WHERE customer_id = 100104 19 | ; 20 | 21 | 22 | 23 | SELECT * 24 | FROM customers 25 | WHERE birth_date > '1995-01-01' 26 | ORDER BY total_money_spent DESC 27 | ; 28 | -------------------------------------------------------------------------------- /2.3 Select Statement.sql: -------------------------------------------------------------------------------- 1 | # Select Statement 2 | 3 | 4 | SELECT * 5 | FROM customers; 6 | 7 | 8 | SELECT first_name, 9 | last_name, 10 | phone, 11 | address, 12 | total_money_spent, 13 | (total_money_spent + 100) * 10 14 | FROM customers 15 | WHERE first_name = 'Kelly' 16 | ; 17 | 18 | # PEMDAS 19 | 20 | 21 | 22 | SELECT state 23 | FROM customers; 24 | 25 | SELECT DISTINCT state 26 | FROM customers; 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | # Pratice Question: 44 | # Using the customers table, write a query to show the phone numbers of all 45 | # customer who live in Texas (TX). 46 | 47 | SELECT phone 48 | FROM customers 49 | WHERE state = 'TX' 50 | ; 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /2.4 Where Statement - Comparison and Logical Operators.sql: -------------------------------------------------------------------------------- 1 | # Where Statement 2 | 3 | 4 | 5 | SELECT * 6 | FROM customers 7 | WHERE first_name = 'Kevin' 8 | ; 9 | 10 | SELECT * 11 | FROM customers 12 | WHERE first_name <> 'Kevin' 13 | ; 14 | 15 | 16 | SELECT * 17 | FROM customers 18 | WHERE total_money_spent >= 1009 19 | ; 20 | 21 | 22 | SELECT * 23 | FROM customers 24 | WHERE total_money_spent <= 1009 25 | ; 26 | 27 | # AND, OR, NOT 28 | 29 | SELECT * 30 | FROM customers 31 | WHERE total_money_spent <= 1009 AND state = 'TX' 32 | ; 33 | 34 | SELECT * 35 | FROM customers 36 | WHERE total_money_spent <= 1009 OR state = 'TX' 37 | ; 38 | 39 | 40 | 41 | 42 | SELECT * 43 | FROM customers 44 | WHERE (birth_date < '1995-01-01' OR state = 'PA') AND state = 'NY' 45 | ; 46 | 47 | 48 | SELECT * 49 | FROM customers 50 | WHERE first_name != 'Frodo' 51 | ; 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | # Practice Question 91 | # Using the employees table, write a query to show the employee ID, first and last name, and salary 92 | # of employees that make more that 45k in the bakery department 93 | 94 | SELECT employee_id, first_name, last_name, salary 95 | FROM employees 96 | WHERE salary > '45000' AND department = 'bakery' 97 | ; 98 | 99 | -------------------------------------------------------------------------------- /2.5 IN Operator.sql: -------------------------------------------------------------------------------- 1 | # IN Operator 2 | 3 | 4 | SELECT * 5 | FROM customers 6 | WHERE state IN ('PA','TX','CA') 7 | ; 8 | 9 | 10 | SELECT * 11 | FROM customers 12 | WHERE state = 'PA' OR state = 'TX' OR state = 'CA' 13 | ; 14 | 15 | 16 | SELECT * 17 | FROM customers 18 | WHERE first_name IN ('Kevin','Kelly') 19 | ; 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /2.6 Between Operator.sql: -------------------------------------------------------------------------------- 1 | # Between Operator 2 | 3 | SELECT * 4 | FROM customers 5 | WHERE total_money_spent BETWEEN 534 AND 1009 6 | ; 7 | 8 | 9 | SELECT * 10 | FROM customers 11 | WHERE total_money_spent >= 534 AND total_money_spent <= 1009 12 | ; 13 | 14 | 15 | SELECT * 16 | FROM customers 17 | WHERE birth_date BETWEEN '1990-01-01' AND '2020-01-01' 18 | ; 19 | 20 | 21 | SELECT * 22 | FROM customers 23 | WHERE first_name BETWEEN 'Charles' AND 'Obi' 24 | ; 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | # Practice Question 71 | # Using the products table, select the name of the product where the sale price is 72 | # between $1.25 and $3. 73 | 74 | SELECT product_name 75 | FROM products 76 | WHERE sale_price BETWEEN 1.25 AND 3 77 | ; 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /2.7 LIKE Operator.sql: -------------------------------------------------------------------------------- 1 | # LIKE Operator 2 | 3 | # %, _ 4 | SELECT * 5 | FROM customers 6 | WHERE first_name LIKE 'k%n' 7 | ; 8 | 9 | 10 | SELECT * 11 | FROM customers 12 | WHERE first_name LIKE '%k%' 13 | ; 14 | 15 | 16 | SELECT * 17 | FROM customers 18 | WHERE first_name LIKE 'm______' 19 | ; 20 | 21 | 22 | 23 | SELECT * 24 | FROM customers 25 | WHERE first_name LIKE 'D_' 26 | ; 27 | 28 | 29 | SELECT * 30 | FROM customers 31 | WHERE last_name LIKE 's_____%' 32 | ; 33 | 34 | 35 | SELECT * 36 | FROM customers 37 | WHERE phone LIKE '9%' 38 | ; 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /2.8 Order By.sql: -------------------------------------------------------------------------------- 1 | # ORDER BY 2 | 3 | SELECT * 4 | FROM customers 5 | ORDER BY first_name DESC 6 | ; 7 | 8 | 9 | 10 | SELECT state, total_money_spent 11 | FROM customers 12 | ORDER BY total_money_spent DESC, state DESC 13 | ; 14 | 15 | 16 | SELECT * 17 | FROM customers 18 | ORDER BY 8 DESC ,9 DESC 19 | ; 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /2.9 Limit.sql: -------------------------------------------------------------------------------- 1 | # LIMIT 2 | 3 | 4 | SELECT * 5 | FROM customers 6 | WHERE total_money_spent < 8000 7 | ORDER BY total_money_spent DESC 8 | LIMIT 5 9 | ; 10 | 11 | 12 | SELECT * 13 | FROM customers 14 | WHERE total_money_spent < 8000 15 | ORDER BY total_money_spent DESC 16 | LIMIT 3,2 17 | ; 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | # Practice Question 48 | # Using the customers table, write a query to show the top 2 customers by money spent 49 | 50 | SELECT * 51 | FROM customers 52 | ORDER BY total_money_spent DESC 53 | LIMIT 2; 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /3.2 Using Group By.sql: -------------------------------------------------------------------------------- 1 | # Using Group By 2 | 3 | 4 | SELECT customer_id,COUNT(tip) AS count_tips ,SUM(tip) AS total_tip 5 | FROM customer_orders 6 | GROUP BY customer_id 7 | ORDER BY total_tip DESC 8 | ; 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | # Practice Question 26 | # Using the employees table, write a query to show the average salary for each department 27 | 28 | SELECT department, AVG(salary) 29 | FROM employees 30 | GROUP BY department 31 | ; 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /3.3 Aggregate Functions.sql: -------------------------------------------------------------------------------- 1 | # Aggregate Functions 2 | 3 | SELECT customer_id, SUM(order_total) 4 | FROM customer_orders 5 | GROUP BY customer_id 6 | ; 7 | 8 | 9 | SELECT customer_id, AVG(order_total) 10 | FROM customer_orders 11 | GROUP BY customer_id 12 | ; 13 | 14 | SELECT customer_id, 15 | MAX(order_total), 16 | MIN(order_total) 17 | FROM customer_orders 18 | GROUP BY customer_id 19 | ; 20 | 21 | 22 | SELECT customer_id, COUNT(order_total) 23 | FROM customer_orders 24 | GROUP BY customer_id 25 | ; 26 | 27 | 28 | SELECT first_name, COUNT(phone) 29 | FROM customers 30 | GROUP BY first_name 31 | ; 32 | 33 | 34 | SELECT product_id, COUNT(tip), COUNT(DISTINCT tip) 35 | FROM customer_orders 36 | GROUP BY product_id 37 | ; 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | # Practice Question 67 | # Using the employee table, write a query to show the average salary and the max salary in 68 | # each department 69 | 70 | SELECT department, AVG(salary), MAX(salary) 71 | FROM employees 72 | GROUP BY department 73 | ; -------------------------------------------------------------------------------- /3.4 Having vs Where.sql: -------------------------------------------------------------------------------- 1 | # HAVING vs WHERE 2 | 3 | 4 | SELECT customer_id, SUM(tip) AS total_tips 5 | FROM customer_orders 6 | WHERE total_tips > 5 7 | GROUP BY customer_id 8 | ; 9 | 10 | 11 | SELECT customer_id, SUM(tip) AS total_tips 12 | FROM customer_orders 13 | GROUP BY customer_id 14 | HAVING total_tips > 5 15 | ; 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | # Practice Question 59 | # Using the customer orders table, write a query to show the products that had 2 or more orders 60 | 61 | SELECT product_id, COUNT(order_id) as orders 62 | FROM customer_orders 63 | GROUP BY product_id 64 | HAVING orders > 1 65 | ; 66 | -------------------------------------------------------------------------------- /4.2 Inner Joins.sql: -------------------------------------------------------------------------------- 1 | # Inner Joins 2 | 3 | SELECT * 4 | FROM customers; 5 | 6 | SELECT * 7 | FROM customer_orders; 8 | 9 | 10 | SELECT * 11 | FROM customers c 12 | JOIN customer_orders co 13 | ON c.customer_id = co.customer_id 14 | ORDER BY co.customer_id 15 | ; 16 | 17 | 18 | SELECT * 19 | FROM products; 20 | 21 | SELECT * 22 | FROM customer_orders; 23 | 24 | # product name, product id, order_total 25 | SELECT product_name, p.product_id, SUM(order_total) 26 | FROM products p 27 | INNER JOIN customer_orders co 28 | ON p.product_id = co.product_id 29 | GROUP BY product_name, p.product_id 30 | ; 31 | 32 | 33 | SELECT * 34 | FROM suppliers; 35 | 36 | SELECT * 37 | FROM ordered_items; 38 | 39 | 40 | SELECT * 41 | FROM suppliers s 42 | JOIN ordered_items oi 43 | ON s.supplier_id = oi.shipper_id 44 | ; 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /4.3 Joining Multiple Tables.sql: -------------------------------------------------------------------------------- 1 | # Joining on Multiple Tables 2 | 3 | SELECT product_name, order_total, first_name 4 | FROM products p 5 | JOIN customer_orders co 6 | ON p.product_id = co.product_id 7 | JOIN customers c 8 | ON co.customer_id = c.customer_id 9 | ; 10 | 11 | 12 | SELECT p.product_id, co.product_id, co.customer_id, c.customer_id 13 | FROM products p 14 | JOIN customer_orders co 15 | ON p.product_id = co.product_id 16 | JOIN customers c 17 | ON co.customer_id = c.customer_id 18 | ; 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | # Practice Question 62 | # Given these 3 tables (suppliers, ordered_items, customer_orders), write a query to return 63 | # the name of the supplier and the sum of the total order amount for each supplier 64 | 65 | SELECT name, SUM(order_total) 66 | FROM suppliers s 67 | JOIN ordered_items oi 68 | ON s.supplier_id = oi.shipper_id 69 | JOIN customer_orders co 70 | ON oi.order_id = co.order_id 71 | GROUP BY name 72 | ; 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /4.4 Joining on Multiple Conditions.sql: -------------------------------------------------------------------------------- 1 | # Joining on Multiple Conditions 2 | 3 | 4 | SELECT * 5 | FROM customer_orders; 6 | 7 | SELECT * 8 | FROM customer_orders_review; 9 | 10 | 11 | SELECT * 12 | FROM customer_orders co 13 | JOIN customer_orders_review cor 14 | ON co.order_id = cor.order_id 15 | AND co.customer_id = cor.customer_id 16 | AND co.order_date = cor.order_date 17 | ; 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /4.5 Outer Joins.sql: -------------------------------------------------------------------------------- 1 | # Outer Joins 2 | 3 | SELECT * 4 | FROM customers c 5 | LEFT OUTER JOIN customer_orders co 6 | ON c.customer_id = co.customer_id 7 | ORDER BY c.customer_id 8 | ; 9 | 10 | 11 | SELECT * 12 | FROM customers c 13 | RIGHT OUTER JOIN customer_orders co 14 | ON c.customer_id = co.customer_id 15 | ORDER BY c.customer_id 16 | ; 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /4.6 Self Join.sql: -------------------------------------------------------------------------------- 1 | # Self Joins 2 | 3 | # Use Case/Practice Question 4 | 5 | # In the customer table, the person with the next highest Customer ID is the that person's boss. 6 | # Write a query to return the first and last name of both the employee and their boss 7 | 8 | SELECT c. customer_id, 9 | c.first_name, 10 | c.last_name, 11 | ss.customer_id boss_id, 12 | ss.first_name boss_first_name, 13 | ss.last_name boss_last_name 14 | FROM customers c 15 | JOIN customers ss 16 | ON c.customer_id = ss.customer_id - 1 17 | ; 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /4.7 Cross Joins.sql: -------------------------------------------------------------------------------- 1 | # Cross Joins 2 | 3 | SELECT c.customer_id, first_name, order_id, co.customer_id 4 | FROM customers c 5 | CROSS JOIN customer_orders co 6 | ORDER BY c.customer_id, order_id ; 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /4.8 Unions.sql: -------------------------------------------------------------------------------- 1 | # Unions 2 | 3 | SELECT first_name, last_name 4 | FROM customers 5 | UNION 6 | SELECT product_id, product_name 7 | FROM products; 8 | 9 | 10 | 11 | SELECT customer_id, first_name, 'OLD' Label 12 | FROM customers 13 | WHERE birth_date < '1950-01-01' 14 | UNION 15 | SELECT c.customer_id, first_name, 'Good Tipper' 16 | FROM customers c 17 | JOIN customer_orders co 18 | ON c.customer_id = co.customer_id 19 | WHERE tip > 4; 20 | 21 | 22 | SELECT customer_id, first_name, 'OLD' Label 23 | FROM customers 24 | WHERE birth_date < '1950-01-01' 25 | UNION ALL 26 | SELECT customer_id, first_name, 'OLD' Label 27 | FROM customers 28 | WHERE birth_date < '1950-01-01' 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /5.2 Subqueries.sql: -------------------------------------------------------------------------------- 1 | # Subqueries 2 | 3 | 4 | SELECT * 5 | FROM customers 6 | WHERE customer_id IN 7 | (SELECT DISTINCT customer_id 8 | FROM customer_orders 9 | WHERE tip > 2) 10 | ; 11 | SELECT * 12 | FROM customer_orders; 13 | 14 | 15 | 16 | 17 | 18 | SELECT * 19 | FROM customers 20 | WHERE total_money_spent > (SELECT AVG(total_money_spent) FROM customers) 21 | ; 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | # Practice Question 50 | # Using customers, customers orders, and products table - write a subquery to return 51 | # the first name and last name of customers who ordered something with chocolate in it. 52 | 53 | SELECT DISTINCT first_name, last_name 54 | FROM customers c 55 | JOIN customer_orders co 56 | ON c.customer_id = co.customer_id 57 | WHERE product_id IN 58 | (SELECT product_id 59 | FROM products 60 | WHERE product_name LIKE 'Chocolate%' 61 | ); 62 | 63 | SELECT * 64 | FROM products; 65 | 66 | 67 | 68 | 69 | 70 | # Practice Question 71 | # Using the employees table, use a subquery to select the 2nd highest paid employee 72 | 73 | SELECT * 74 | FROM employees 75 | WHERE Salary NOT IN 76 | (SELECT MAX(Salary) 77 | FROM employees 78 | ) 79 | ORDER BY salary DESC 80 | LIMIT 1; 81 | 82 | 83 | SELECT * 84 | FROM employees 85 | WHERE Salary NOT IN 86 | (SELECT employee_id 87 | FROM employees 88 | ORDER BY salary DESC 89 | LIMIT 1 90 | ) 91 | ORDER BY salary DESC 92 | LIMIT 1; 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /5.3 ANY and ALL.sql: -------------------------------------------------------------------------------- 1 | # ANY and ALL in Subqueries 2 | 3 | 4 | SELECT * 5 | FROM ordered_items; 6 | 7 | 8 | SELECT MAX(quantity * unit_price) AS total_order_price 9 | FROM ordered_items 10 | WHERE shipper_id = 1 11 | ; 12 | 13 | SELECT *, (quantity * unit_price) AS total_order_price 14 | FROM ordered_items 15 | WHERE (quantity * unit_price) > (SELECT MAX(quantity * unit_price) AS total_order_price 16 | FROM ordered_items 17 | WHERE shipper_id = 1) 18 | ; 19 | 20 | SELECT *, (quantity * unit_price) AS total_order_price 21 | FROM ordered_items 22 | WHERE (quantity * unit_price) > ALL (SELECT (quantity * unit_price) AS total_order_price 23 | FROM ordered_items 24 | WHERE shipper_id = 1) 25 | ; 26 | 27 | SELECT *, (quantity * unit_price) AS total_order_price 28 | FROM ordered_items 29 | WHERE (quantity * unit_price) = ANY (SELECT (quantity * unit_price) AS total_order_price 30 | FROM ordered_items 31 | WHERE shipper_id = 1) 32 | ; 33 | 34 | -------------------------------------------------------------------------------- /5.4 Subqueries in the FROM and SELECT Statement.sql: -------------------------------------------------------------------------------- 1 | # Subqueries in SELECT and FROM 2 | 3 | 4 | SELECT product_id, quantity, (SELECT AVG(quantity) FROM ordered_items) 5 | FROM ordered_items; 6 | 7 | 8 | SELECT product_id, 9 | quantity, 10 | (SELECT SUM(quantity) FROM ordered_items) AS Sum_of_total, 11 | (quantity/(SELECT SUM(quantity) FROM ordered_items)*100) AS Percentage_of_all_orders 12 | FROM ordered_items; 13 | 14 | 15 | SELECT new_column 16 | FROM (SELECT product_id, 17 | quantity, 18 | (SELECT AVG(quantity) FROM ordered_items) AS new_column 19 | FROM ordered_items) AS avg_quantity 20 | ; 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | # Practice Question 72 | # Given the customer_orders table, Use a subquery to determine the customers who have made 73 | # made a purchase that was higher than the average total purchase of all the orders. 74 | # Have the customer ID, order_total, and the average of order totals in your output. 75 | 76 | SELECT customer_id, order_total, (SELECT AVG(order_total) FROM customer_orders) 77 | FROM customer_orders 78 | WHERE order_total > (SELECT AVG(order_total) FROM customer_orders); 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /6.2 Window Function Basics - OVER() and Partition By.sql: -------------------------------------------------------------------------------- 1 | # OVER() and Partition By 2 | 3 | SELECT c.customer_id, first_name, order_total, MAX(order_total) 4 | FROM customers c 5 | JOIN customer_orders co 6 | ON c.customer_id = co.customer_id 7 | GROUP BY c.customer_id, first_name, order_total 8 | ; 9 | 10 | SELECT c.customer_id, 11 | first_name, 12 | order_total, 13 | AVG(order_total) OVER(PARTITION BY first_name ORDER BY first_name) 14 | FROM customers c 15 | JOIN customer_orders co 16 | ON c.customer_id = co.customer_id 17 | ; 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | # Practice Question 65 | # Given the customer orders table, provide a rolling SUM of purchases each customer has made, 66 | # from smallest to largest purchase. 67 | # Give the customer ID, order total, and rolling order total called "Rolling_Total" 68 | 69 | SELECT customer_id, 70 | order_total, 71 | SUM(order_total) OVER(PARTITION BY customer_id ORDER BY order_total) AS Rolling_Total 72 | FROM customer_orders; 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /6.3 Row_Number().sql: -------------------------------------------------------------------------------- 1 | # ROW_NUMBER 2 | 3 | 4 | SELECT * 5 | FROM ( 6 | SELECT c.customer_id, 7 | first_name, 8 | order_total, 9 | ROW_NUMBER() OVER(PARTITION BY first_name ORDER BY order_total DESC) AS row_num 10 | FROM customers c 11 | JOIN customer_orders co 12 | ON c.customer_id = co.customer_id 13 | ) AS Row_Table 14 | WHERE row_num <= 2 15 | ; 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /6.4 Rank and Dense_Rank.sql: -------------------------------------------------------------------------------- 1 | # Rank and Dense_Rank 2 | 3 | 4 | SELECT * 5 | FROM (SELECT *, 6 | RANK() OVER(PARTITION BY department ORDER BY salary)AS Rank_col, 7 | DENSE_RANK() OVER(PARTITION BY department ORDER BY salary)AS Dense_Rank_col, 8 | ROW_NUMBER() OVER(PARTITION BY department ORDER BY salary)AS row_number_col 9 | FROM employees 10 | ) random_table 11 | WHERE Rank_col = 3 ; 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /6.5 Lag and Lead.sql: -------------------------------------------------------------------------------- 1 | # Lag and Lead 2 | 3 | SELECT *, 4 | LAG(salary) OVER(PARTITION BY department ORDER BY salary) lags, 5 | LEAD(salary) OVER(PARTITION BY department ORDER BY salary) leads 6 | FROM employees 7 | ; 8 | 9 | SELECT *, 10 | CASE 11 | WHEN salary < lags THEN 'Less' 12 | WHEN salary = lags THEN 'Equal' 13 | ELSE 'More' 14 | END AS label 15 | FROM ( 16 | SELECT *, 17 | LAG(salary) OVER(PARTITION BY department ORDER BY employee_id) lags 18 | FROM employees 19 | ) AS temp_table 20 | ; 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MySQL-Crash-Course --------------------------------------------------------------------------------