SQL Case Study 2 Solutions
SQL Case Study 2 Solutions
--1 Display the count of customer in each region who has done the
transaction in year 2020
--5 Display the detail of customer id, region name, transaction type
and transaction amount for the minimum transaction amount in
deposit
BEGIN TRY
SELECT region_id + region_name from Continent
END TRY
BEGIN CATCH
SELECT ERROR_STATE() AS ErrorState , ERROR_MESSAGE()
ErrorMsg ;
END CATCH;
GO
BEGIN TRY
END TRY
BEGIN CATCH
SELECT * FROM (
SELECT *,
DENSE_RANK () OVER (
PARTITION BY txn_type
ORDER BY txn_amount DESC
) amount_rank
FROM
[dbo].[Transactions]
)t
WHERE amount_rank < 5;