sqlapache-spark-sqlsasdatabrickscode-conversion

Need help in finding Spark SQL code equivalent to SAS Code


I have a piece of code which I need to convert from SAS to Spark SQL. I want to know what is the equivalent function for as that in SAS

SAS Code:

DATA NEW_TABLE;
SET
SOURCE_TABLE1
SOURCE_TABLE2
;
RUN;

I do understand that it's creating a new table by joining the existing two source tables. But not able to understand how that converts to SQL


Solution

  • In standard SQL syntax, that would be a UNION or UNION ALL.

    create table new_table as
    select * from source_table1
    union
    select * from source_table2
    

    The above assumes that the columns in both source tables are identical.

    If the columns are not identical, use union corresponding instead (SAS SQL only).