2.2 What is an ad-hoc query?
Ans: It is a non-standard inquiry. An ad hoc query is created to obtain information as the need arises. Contrast with a query that is predefined and routinely processed.
2.12 What does DDL stand for? What are DDL statements?
Ans: DDL stands for Data Definition Language. These statements define the database schema or the structure. DDL queries used for creating tables, relationships, and other database querying and modifying data. Common DDL Statements are CREATE, ALTER, DROP, TRUNCATE, COMMENT and RENAME.
2.13 What is the SQL SELECT/FROM/WHERE framework?
Ans: SELECT clause specifies which columns are to list in the query results. FROM clause specifies which tables are to be used in the query. WHERE clause specifies which rows are to listed in the query result
2.17 Write an SQL statement to display SKU and SKU_Description.
Ans: SELECT SKU, SKU_Description FROM INVENTORY;
2.19 Write an SQL statement to display WarehouseID.
Ans: SELECT WarehouseID FROM INVENTORY;
2.22 Write an SQL statement to display all of the columns using the SQL asterisk (*)
Wildcard character.
Ans: SELECT * FROM INVENTORY;
2.23 Write an SQL statement to display all data on products having a QuantityOnHand greater than 0.
Ans: SELECT * FROM INVENTORY WHERE QuantityOnHand >0;
2.25 Write an SQL statement to display the SKU, SKU_Description, and WarehouseID for products having QuantityOnHand equal to 0. Sort the results in ascending order by WarehouseID.
Ans: SELECT SKU, SKU_Description, WarehouseID FROM INVENTORY WHERE QuantityOnHand = 0 ORDER BY WarehouseID;
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.
Ans: SELECT SKU, SKU_Description, WarehouseID FROM INVENTORY
WHERE QuantityOnHand = 0 AND QuantityOnOrder