Finalized sql, docx, pdf
This commit is contained in:
parent
8b259d817e
commit
584e1921a0
1
.~lock.Schrick-Noah_Case-Study-1.docx#
Normal file
1
.~lock.Schrick-Noah_Case-Study-1.docx#
Normal file
@ -0,0 +1 @@
|
|||||||
|
,noah,NovaArchSys,30.08.2022 20:00,file:///home/noah/.config/libreoffice/4;
|
||||||
36
README.md
36
README.md
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
- Use the Cape\_Codd database
|
- Use the Cape\_Codd database
|
||||||
- Use only the Inventory table
|
- Use only the Inventory table
|
||||||
- Deliver a single sql file
|
- Deliver a single sql file, along with a document that contains all the content from the sql file
|
||||||
- Each query should start with a comment line that looks like:
|
- Each query should start with a comment line that looks like:
|
||||||
/* *** CS1-\<CH-Q> *** \*/
|
/* *** CS1-\<CH-Q> *** \*/
|
||||||
Example for Exercies 2.17:
|
Example for Exercies 2.17:
|
||||||
@ -14,38 +14,38 @@
|
|||||||
|
|
||||||
## Exercises 2.17 - 2.33
|
## Exercises 2.17 - 2.33
|
||||||
|
|
||||||
2.17) Write an SQL statement to display SKU and SKU\_Description.
|
2.17) Write a SQL statement to display SKU and SKU\_Description.
|
||||||
|
|
||||||
2.18) Write an SQL statement to display SKU\_Description and SKU.
|
2.18) Write a SQL statement to display SKU\_Description and SKU.
|
||||||
|
|
||||||
2.19) Write an SQL statement to display WarehouseID.
|
2.19) Write a SQL statement to display WarehouseID.
|
||||||
|
|
||||||
2.20) Write an SQL statement to display unique WarehouseIDs.
|
2.20) Write a SQL statement to display unique WarehouseIDs.
|
||||||
|
|
||||||
2.21) Write an SQL statement to display all of the columns without using the SQL asterisk (wildcard character).
|
2.21) Write a SQL statement to display all of the columns without using the SQL asterisk (wildcard character).
|
||||||
|
|
||||||
2.22) Write an SQL statement to display all of the columns using the SQL asterisk (wildcard character)
|
2.22) Write a SQL statement to display all of the columns using the SQL asterisk (wildcard character)
|
||||||
|
|
||||||
2.23) Write an SQL statement to display all data on products having a QuantityOnHand greater than 0.
|
2.23) Write a SQL statement to display all data on products having a QuantityOnHand greater than 0.
|
||||||
|
|
||||||
2.24) Write an SQL statement to display the SKU and SKU\_Description for products having QuantityOnHand equal to 0.
|
2.24) Write a SQL statement to display the SKU and SKU\_Description for products having QuantityOnHand equal to 0.
|
||||||
|
|
||||||
2.25) Write an SQL statement to display the SKU, SKU\_Description, and WarehouseID for products that have a QuantityOnHand equal to 0. Sort the results in ascending order by WarehouseID.
|
2.25) Write a SQL statement to display the SKU, SKU\_Description, and WarehouseID for products that have a QuantityOnHand equal to 0. Sort the results in ascending order by WarehouseID.
|
||||||
|
|
||||||
2.26) Write an SQL statement to display the SKU, SKU\_Description, and WarehouseID for products that have a QuantityOnHand greater than 0. Sort the results in descending order by WarehouseID and in ascending order by SKU.
|
2.26) Write a SQL statement to display the SKU, SKU\_Description, and WarehouseID for products that have a QuantityOnHand greater than 0. Sort the results in descending order by WarehouseID and in ascending order by SKU.
|
||||||
|
|
||||||
2.27) Write an SQL statement to display SKU, SKU\_Description, and WarehouseID for all products that have a QuantityOnHand equal to 0 and a QuantityOnOrder greater than 0. Sort the results in descending order by WarehouseID and in ascending order by SKU.
|
2.27) Write a SQL statement to display SKU, SKU\_Description, and WarehouseID for all products that have a QuantityOnHand equal to 0 and a QuantityOnOrder greater than 0. Sort the results in descending order by WarehouseID and in ascending order by SKU.
|
||||||
|
|
||||||
2.28) Write an SQL statement to display SKU, SKU\_Description, and WarehouseID for all products that have a QuantityOnHand equal to 0 or a QuantityOnOrder equal to 0. Sort the results in descending order by WarehouseID and in ascending order by SKU.
|
2.28) Write a SQL statement to display SKU, SKU\_Description, and WarehouseID for all products that have a QuantityOnHand equal to 0 or a QuantityOnOrder equal to 0. Sort the results in descending order by WarehouseID and in ascending order by SKU.
|
||||||
|
|
||||||
2.29) Write an SQL statement to display the SKU, SKU\_Description, WarehouseID, and QuantityOnHand for all products having a QuantityOnHand greater than 1 and less than 10. Do not use the BETWEEN keyword.
|
2.29) Write a SQL statement to display the SKU, SKU\_Description, WarehouseID, and QuantityOnHand for all products having a QuantityOnHand greater than 1 and less than 10. Do not use the BETWEEN keyword.
|
||||||
|
|
||||||
2.30) Write an SQL statement to display the SKU, SKU\_Description, WarehouseID, and QuantityOnHand for all products having a QuantityOnHand greater than 1 and less than 10. Use the BETWEEN keyword.
|
2.30) Write a SQL statement to display the SKU, SKU\_Description, WarehouseID, and QuantityOnHand for all products having a QuantityOnHand greater than 1 and less than 10. Use the BETWEEN keyword.
|
||||||
|
|
||||||
2.31) Write an SQL statement to show a unique SKU and SKU\_Description for all products with an SKU description starting with ‘Half-Dome’.
|
2.31) Write a SQL statement to show a unique SKU and SKU\_Description for all products with an SKU description starting with ‘Half-Dome’.
|
||||||
|
|
||||||
2.32) Write an SQL statement to show a unique SKU and SKU\_Description for all products with a description that includes the word ‘Climb’.
|
2.32) Write a SQL statement to show a unique SKU and SKU\_Description for all products with a description that includes the word ‘Climb’.
|
||||||
|
|
||||||
2.33) Write an SQL statement to show a unique SKU and SKU\_Description for all products with a ‘d’ in the third position from the left in SKU\_Description.
|
2.33) Write a SQL statement to show a unique SKU and SKU\_Description for all products with a ‘d’ in the third position from the left in SKU\_Description.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
Schrick-Noah_Case-Study-1.docx
Normal file
BIN
Schrick-Noah_Case-Study-1.docx
Normal file
Binary file not shown.
BIN
Schrick-Noah_Case-Study-1.pdf
Normal file
BIN
Schrick-Noah_Case-Study-1.pdf
Normal file
Binary file not shown.
101
Schrick-Noah_Case-Study-1.sql
Normal file
101
Schrick-Noah_Case-Study-1.sql
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/* *** CS1-2.17 *** */
|
||||||
|
SELECT SKU, SKU_Description
|
||||||
|
FROM INVENTORY
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.18 *** */
|
||||||
|
SELECT SKU_Description, SKU
|
||||||
|
FROM INVENTORY
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.19 *** */
|
||||||
|
SELECT WarehouseID
|
||||||
|
FROM INVENTORY
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.20 *** */
|
||||||
|
SELECT DISTINCT WarehouseID
|
||||||
|
FROM INVENTORY
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.21 *** */
|
||||||
|
SELECT WarehouseID, SKU, SKU_Description, QuantityOnHand, QuantityOnOrder
|
||||||
|
FROM INVENTORY
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.22 *** */
|
||||||
|
SELECT *
|
||||||
|
FROM INVENTORY
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.23 *** */
|
||||||
|
SELECT *
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE QuantityOnHand > 0
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.24 *** */
|
||||||
|
SELECT SKU, SKU_Description
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE QuantityOnHand = 0
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.25 *** */
|
||||||
|
SELECT SKU, SKU_Description, WarehouseID
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE QuantityOnHand = 0
|
||||||
|
ORDER BY WarehouseID ASC
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.26 *** */
|
||||||
|
SELECT SKU, SKU_Description, WarehouseID
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE QuantityOnHand > 0
|
||||||
|
ORDER BY WarehouseID DESC, SKU ASC
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.27 *** */
|
||||||
|
SELECT SKU, SKU_Description, WarehouseID
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE QuantityOnHand = 0 AND QuantityOnOrder > 0
|
||||||
|
ORDER BY WarehouseID DESC, SKU ASC
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.28 *** */
|
||||||
|
SELECT SKU, SKU_Description, WarehouseID
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE QuantityOnHand = 0 OR QuantityOnOrder = 0
|
||||||
|
ORDER BY WarehouseID DESC, SKU ASC
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.29 *** */
|
||||||
|
SELECT SKU, SKU_Description, WarehouseID, QuantityOnHand
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE QuantityOnHand > 1 AND QuantityOnHand < 10
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.30 *** */
|
||||||
|
SELECT SKU, SKU_Description, WarehouseID, QuantityOnHand
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE QuantityOnHand BETWEEN 2 AND 9
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.31 *** */
|
||||||
|
SELECT DISTINCT SKU, SKU_Description
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE SKU_Description LIKE 'Half-Dome%'
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.32 *** */
|
||||||
|
SELECT DISTINCT SKU, SKU_Description
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE SKU_Description LIKE '%Climb%'
|
||||||
|
;
|
||||||
|
|
||||||
|
/* *** CS1-2.33 *** */
|
||||||
|
SELECT DISTINCT SKU, SKU_Description
|
||||||
|
FROM INVENTORY
|
||||||
|
WHERE SKU_Description LIKE '__d%'
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user