JOINing two datasets together, and merging columns together to get rid of nulls.

Ғылым және технология

My SQL Server Udemy courses are:
70-461, 70-761 Querying Microsoft SQL Server with T-SQL: rebrand.ly/querying-microsoft...
98-364: Database Fundamentals (Microsoft SQL Server): rebrand.ly/database-fundamentals
70-462 SQL Server Database Administration (DBA): rebrand.ly/sql-server-dba
Microsoft SQL Server Reporting Services (SSRS): rebrand.ly/sql-server-ssrs
SQL Server Integration Services (SSIS): rebrand.ly/sql-server-ssis
SQL Server Analysis Services (SSAS): rebrand.ly/sql-server-ssas-mdx
Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): rebrand.ly/microsoft-powerpiv...
----
In this view, we have the following views:
CREATE VIEW view1 as
SELECT object_id, name, create_date, schema_id
FROM sys.objects
WHERE object_ID BETWEEN 1 AND 9
GO
CREATE VIEW view2 AS
SELECT object_id, name, modify_date, schema_id
FROM sys.objects
WHERE object_ID BETWEEN 6 AND 17
GO
----
Each of these videos have got 6 rows, 4 of which are in both views.
In this video, I am going to merge these 2 views together, so that there is a total of 8 views. However, there will also be 8 columns, such as 2 object_id columns and 2 name columns. There will be a lot of NULLs where the rows are not in both views.
The next task is to merge the two object_id columns together, so that we get rid of the NULLs and have just one object_id.
In this video, I will use three different ways of doing this, using the CASE, ISNULL and CASE WHEN ... IS NULL.

Пікірлер: 15

  • @centox8534
    @centox8534 Жыл бұрын

    This Channel is quite undervalued. High high quality contents!

  • @maicocentofanti8067

    @maicocentofanti8067

    Жыл бұрын

    agree, amazing contents

  • @Broomtwo
    @Broomtwo7 ай бұрын

    I was playing around trying to figure out a similar situation, and this was precisely the answer I was looking for. Thanks!

  • @shadowitself
    @shadowitself11 ай бұрын

    great in fact of content and language :D super comprehensive, thx

  • @donpac3531
    @donpac353110 ай бұрын

    WOW! JUST WOW!!!!! thank you!

  • @sergeykhachaturyan5393
    @sergeykhachaturyan5393 Жыл бұрын

    Supper explanation!

  • @justthien
    @justthien9 ай бұрын

    Thank you, what if my data has numerous columns that I couldn't spend enough time to combine them as I wish, like what you did in the video?

  • @SQLServer101

    @SQLServer101

    9 ай бұрын

    Hi Just. If you have numerous columns, you can use SELECT * to return all columns. Phillip

  • @engraliraza4125
    @engraliraza4125 Жыл бұрын

    How to combine two CSV if columns are the same for two CSV'S but row's are differently

  • @SQLServer101

    @SQLServer101

    Жыл бұрын

    Hi Engraliraza. You should import the two csv files into two tables, and then combine them into one using an INSERT SELECT...UNION SELECT... Phillip

  • @juanpauloalmazan2997
    @juanpauloalmazan2997 Жыл бұрын

    can you make a video join two table with a date, wher table 1 is in day date and table 2 is in week date.

  • @SQLServer101

    @SQLServer101

    Жыл бұрын

    Hi Juan. That's a good idea. I'll put it on the list. Phillip

  • @SQLServer101

    @SQLServer101

    Жыл бұрын

    I have now created this video - it is available at kzread.info/dash/bejne/mpyJldmMeZTfhaQ.html . Phillip

  • @juanpauloalmazan2997

    @juanpauloalmazan2997

    Жыл бұрын

    @@SQLServer101 awesome! thank you so much.

  • @juanpauloalmazan2997

    @juanpauloalmazan2997

    Жыл бұрын

    @@SQLServer101 I have problem joining multiple tables. basically I have 6tables. 5 are fact table and 1 is roster based on the criteria of ID and Date. I use the fact table with most daily info as my base and I used full join for all the fact table and left join the base to the roster table with coalesce on the select for ID and date that are nulls. however, i noticed that when other tables doesnt have a match ID or date, the roster becomes null. how can I resolved this. I want a result that a roster still distribute the info for each table when combine.

Келесі