USE [TestDUTASJobSchedule];
GO

/**************************************************************************************************
-- FILE: FederalHolidays.sql
-- PURPOSE: Manage FederalHolidays table - Create, Read, Update, Delete for a single holiday
-- TABLE: dbo.FederalHolidays
**************************************************************************************************/

-------------------------------
-- SELECT - View Holiday
-------------------------------
SELECT *
FROM [dbo].[FederalHolidays]
WHERE [Year] = 2025
  AND [HolidayName] = N'New Year''s Day';
GO

-------------------------------
-- INSERT - Create Holiday
-------------------------------
INSERT INTO [dbo].[FederalHolidays]
(
    [HolidayDate],
    [HolidayName],
    [Year]
)
VALUES
(
    '2025-01-01',          -- Holiday date
    N'New Year''s Day',    -- Holiday name
    2025                   -- Year
);
GO

-------------------------------
-- UPDATE - Modify Holiday
-------------------------------
UPDATE [dbo].[FederalHolidays]
SET
    [HolidayName] = N'New Year''s Day (Observed)',
    [HolidayDate] = '2025-01-02'
WHERE
    [Year] = 2025
    AND [HolidayName] = N'New Year''s Day';
GO

-------------------------------
-- DELETE - Remove Holiday
-------------------------------
DELETE FROM [dbo].[FederalHolidays]
WHERE [Year] = 2025
  AND [HolidayName] = N'New Year''s Day (Observed)';
GO

-------------------------------
-- SELECT - View Holiday
-------------------------------
SELECT *
FROM [dbo].[FederalHolidays]
WHERE [Year] = 2025
  AND [HolidayName] = N'New Year''s Day';
GO
