Conversation
gacurl
left a comment
There was a problem hiding this comment.
comments available - nicely done here.
| 1. Use an SQL SELECT statement to retrieve the first 10 rows of the Customer table, ordered by CustomerName. | ||
| Paste your SQL statement below: | ||
| - SELECT * FROM Products LIMIT 10; | ||
|
|
There was a problem hiding this comment.
this query retrieves the first 120 rows of the Products table.
since you need the first 10 rows of the Customer Table ordered by Customer Name, please resubmit with accurate query.
Retrieve from the Customers table and order by CustomerName.
| - SELECT ProductName, Price | ||
| FROM Products | ||
| WHERE Price < 20; | ||
|
|
| - SELECT * | ||
| FROM Employees | ||
| WHERE LastName LIKE "C%"; | ||
|
|
| INNER JOIN Customers | ||
| ON Orders.CustomerID = Customers.CustomerID | ||
| WHERE CustomerName LIKE "A%"; | ||
|
|
There was a problem hiding this comment.
correct! As you grow into your SQL skills, consider better readability. You're likely gonna come back to your code in the future and then try to remember what you want/ed the code to do.
as an improvement (READ: the code works - this is only a thought to improve)
1 - Use table aliases (o for Orders and c for Customers) for better readability, and
2 - make sure to use SINGLE quotes for string literals in SQL.
below:
SELECT o.OrderID, c.CustomerName
FROM Orders o
INNER JOIN Customers c ON o.CustomerID = c.CustomerID
WHERE c.CustomerName LIKE 'A%';
| ON c.CustomerID = o.CustomerID | ||
| ORDER BY CustomerName ASC; | ||
|
|
||
|
|
There was a problem hiding this comment.
you'll need to specify the query based on the alias you set.
Order by c.CustomerName to specify the alias.
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
minor hit here with the date formatting - welcome to coding where dates are almost as frustrating as getting a printer/copier to work!
please update OrderDate to the standard SQL date format 'YYYY-MM-DD'
| VALUES (10333, 5, 20), (10444, 6, 20), (10284, 3, 5); | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
nice - but the order number should remain consistent - you need the same order number.
| - DELETE FROM OrderDetails WHERE OrderDetailID = 521; | ||
|
|
||
|
|
||
|
|
| WHERE Price < 20; | ||
|
|
||
|
|
||
|
|
|
|
||
| - DELETE FROM Orders WHERE CustomerID = 76; | ||
| DELETE FROM Customers WHERE CustomerID = 76; | ||
|
|
No description provided.