Practice Activity - Joining SQL Server daily data with irregular periodic data

Поделиться
HTML-код
  • Опубликовано: 13 сен 2024
  • In this video, we will look at joining daily data with period data where the periods are of different durations.
    My SQL Server Udemy courses are:
    70-461, 70-761 Querying Microsoft SQL Server with T-SQL: rebrand.ly/que...
    98-364: Database Fundamentals (Microsoft SQL Server): rebrand.ly/dat...
    70-462 SQL Server Database Administration (DBA): rebrand.ly/sql...
    Microsoft SQL Server Reporting Services (SSRS): rebrand.ly/sql...
    SQL Server Integration Services (SSIS): rebrand.ly/sql...
    SQL Server Analysis Services (SSAS): rebrand.ly/sql...
    Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): rebrand.ly/mic...
    ----
    You may have some periods which are of irregular duration. For example, you may have a table with holiday data.
    In this video, we'll insert the periodic data into the daily data, and then summarise it back to the periods.
    If you're working with SQL Server daily data or irregular periodic data, then this practice activity is a great way to learn how to join the data and understand the data better. Watch the video and learn how to join SQL Server daily data to irregular periodic data in just a few quick steps!
    Here is the starting code:
    DROP TABLE IF EXISTS DailyData
    GO
    CREATE TABLE DailyData
    (EmployeeDate datetime,
    EmployeeCount int);
    INSERT INTO DailyData
    VALUES ('2024-02-01', 5), ('2024-02-02', 2), ('2024-02-03', 5), ('2024-02-04', 7), ('2024-02-05', 8), ('2024-02-06', 7), ('2024-02-07', 4)
    , ('2024-02-08', 1), ('2024-02-09', 6), ('2024-02-10', 1), ('2024-02-11', 3), ('2024-02-12', 4), ('2024-02-13', 3), ('2024-02-14', 6)
    DROP TABLE IF EXISTS PeriodData
    GO
    CREATE TABLE PeriodData
    (PeriodCommencing date,
    PeriodDescription varchar(20))
    INSERT INTO PeriodData
    VALUES ('2024-01-20', 'Period 1'), ('2024-02-02', 'Period 2'), ('2024-02-10', 'Period 3');
    SELECT * FROM DailyData
    SELECT * FROM PeriodData
    ----
    Links to my website are:
    70-461, 70-761 Querying Microsoft SQL Server with T-SQL: idodata.com/que...
    98-364: Database Fundamentals (Microsoft SQL Server): idodata.com/dat...
    SQL Server Essential in an Hour: idodata.com/sql...
    70-462 SQL Server Database Administration (DBA): idodata.com/sql...
    DP-300: Administering Relational Databases: idodata.com/dp-...
    Microsoft SQL Server Reporting Services (SSRS): idodata.com/mic...
    SQL Server Integration Services (SSIS): idodata.com/sql...
    SQL Server Analysis Services (SSAS): idodata.com/sql...
    Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): rebrand.ly/mic...
    1Z0-071 Oracle SQL Developer - certified associate: idodata.com/iz0...
    SQL for Microsoft Access: idodata.com/sql...
    DP-900: Microsoft Azure Data Fundamentals: idodata.com/dp-...

Комментарии •