forked from Code-the-Dream-School/Backend-sqlintro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.txt
More file actions
43 lines (23 loc) · 1.67 KB
/
sql.txt
File metadata and controls
43 lines (23 loc) · 1.67 KB
1
2
3
4
5
6
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
38
39
40
41
42
(1) Using the Customer Table, select the CustomerName, ContactName, and Country. Use ORDER BY to order by Country.
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 CustomerName LIKE 'a%';
(3) Select all columns from the OrderDetails table where the ProductID is 51 and the quantity is greater than 10.
Paste your SQL statement below.
SELECT * FROM OrderDetails WHERE ProductID =51 AND Quantity >10;
(4) Insert 3 rows into the Products table. Note that you will have to specify a valid SupplierID and CategoryID,
corresponding to rows from the Supplier and Category tables. Paste your three SQL statements below.
INSERT INTO Products (ProductID, ProductName, SupplierID, CategoryID, Unit, Price)
VALUES ('78','Tikka Masala','1','1','44 pks', '12');
INSERT INTO Products (ProductID, ProductName, SupplierID, CategoryID, Unit, Price)
VALUES ('80','Garlic Sauce','1','2','4 jars', '30');
INSERT INTO Products (ProductID, ProductName, SupplierID, CategoryID, Unit, Price)
VALUES ('79','Chocolate Syrup','1','2','44 bottles', '20');
(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 = 1 OR ProductID = 2;
(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;