Open
Conversation
franchizi
reviewed
Mar 24, 2021
| Use LIMIT and OFFSET to get entries 11 through 20. Paste your SQL statement below. | ||
|
|
||
| SELECT CustomerName, ContactName, Country FROM Customers ORDER BY Country LIMIT 10 OFFSET 10; | ||
|
|
| (2) Select all columns from the Customer table where the ContactName starts with A. Paste your SQL statement below. | ||
|
|
||
| SELECT * FROM Customers WHERE ContactName LIKE "A%"; | ||
|
|
| Paste your SQL statement below. | ||
|
|
||
| SELECT * FROM OrderDetails WHERE ProductID = 51 AND quantity > 10; | ||
|
|
There was a problem hiding this comment.
Well done, exactly how I would have done it.
| INSERT INTO Products (SupplierID, CategoryID) VALUES (1, 3); | ||
| INSERT INTO Products (SupplierID, CategoryID) VALUES (2, 1); | ||
| INSERT INTO Products (SupplierID, CategoryID) VALUES (2, 4); | ||
|
|
There was a problem hiding this comment.
This works. You could also have done something like below:
INSERT INTO Products
VALUES
(NULL, "Hot Chesse", 1, 1, "1 kg pkg", 30.85),
(NULL, "Nachos", 1, 1, "2kg pkg", 60.55),
(NULL, "Taco Tortilla", 1, 1, "5 kg pkg", 200);
| (5) Update the two top rows of the Products Table to increase the price by 1.50. (Get SQL to do the addition for you.) Paste your SQL statement below. | ||
|
|
||
| UPDATE Products SET price = price + 1.50 WHERE ProductID IN ( SELECT ProductID from Products LIMIT 2); | ||
|
|
There was a problem hiding this comment.
This works. In this case your where condition could be simplified to WHERE ProductID IN (1, 2). However, the way you did it does show how subqueries can be used.
|
|
||
| (6) Delete all rows of the Products Table where the price is less than 7.00. Paste your SQL statement below. | ||
|
|
||
| DELETE FROM Products WHERE price < 7.00; No newline at end of file |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
complete lesson 1 work