:Example 1.0. TableA TableB Field1 Example 1.0. TableA TableB Field1 Field1 1 2 2 5 3 7
Question:
Example 1.0.
TableA | TableB |
Field1 | Field1 |
1 | 2 |
2 | 5 |
3 | 7 |
4 | 6 |
4 | 3 |
5 | 3 |
6 | 9 |
Write SQL queries below based on table layout in Example 1.0.
1. Display data from TableA where the values are identical in TableB.
2. Display data from TableA where the values are not available in TableB.
3. Display data from TableB where the values are not available in TableA.
Create SPs based on the queries of the corresponding questions below.
4. Create a Stored Procedure that passes in the SalesOrderID as a parameter. This stored procedure will return the SalesOrderID, the Date of the transaction and a count of how many times the item was purchased.
5. Create a Stored Procedure that passes in the SalesOrderID as a parameter. This stored procedure will return the SalesOrderID, Date of the transaction, shipping date, City and State.
6. Create a stored procedure that passes in the Territory Name as a parameter. This stored procedure will return the Territory Group, CountryRegionCode, Count of SalesHeaders in 2001, and the Count of SalesDetails in 2001
7. Create a stored procedure that passes in the Product name as a parameter. This stored procedure will return the lowest price in History, Highest Price in History, difference between the two prices, Count of SalesDetails and the Sum of LineTotal.
8. Create a SP that passes in the OrderYear as a parameter. This stored procedure will return the Count of the SalesHeaders and SalesDetails for the OrderYear parameter.