<jupyter_start><jupyter_text>**DOCUMENTACAO**https://spark.apache.org/docs/3.0.2/api/sql/<jupyter_code>%fs ls "FileStore/tables/"
import pyspark.sql.functions as F

dados1 = [
         (1, "Anderson", 1000.00),
         (2, "Kennedy", 2000.00),
         (3, "Bruno", 2300.00),
         (4, "Maria", 2300.00),
         (5, "Eduardo", 2400.00),
         (6, "Mendes", 1900.00),
         (7, "Kethlyn", 1500.00),
         (8, "Thiago", 1800.00),
         (9, "Carla", 2100.00)
]

schema1 = ["id", "Nome", "Salario"]
spark.createDataFrame(data=dados1, schema=schema1).createOrReplaceTempView("funcionarios")

dados2 = [
    (1, "Delhi", "India"),
    (2, "Tamil Nadu", "India"),
    (3, "London", "UK"),
    (4, "Sydney", "Australia"),
    (8, "New York", "USA"),
    (9, "California", "USA"),
    (10, "New Jersey", "USA"),
    (11, "Texas", "USA"),
    (12, "Chicago", "USA")
]
schema2 = ["id", "local", "pais"]
spark.createDataFrame(data=dados2, schema=schema2).createOrReplaceTempView("localizacoes")
%sql
SHOW TABLES<jupyter_output><empty_output><jupyter_text>SELECT campos FROM tabela1 INNER JOIN tabela2 ON tabela1.coluna = tabela2.coluna<jupyter_code>%sql
SELECT * FROM funcionarios INNER JOIN localizacoes ON funcionarios.id = localizacoes.id
%sql
SELECT * FROM funcionarios LEFT OUTER JOIN localizacoes ON funcionarios.id = localizacoes.id
%sql
SELECT * FROM funcionarios RIGHT OUTER JOIN localizacoes ON funcionarios.id = localizacoes.id<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17706919945725916, 'fraction_numerical': 0.06105834464043419, 'mean_word_length': 4.051369863013699, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '389358', 'license': 'MIT', 'n_tokens_mistral': 638, 'n_tokens_neox': 568, 'n_words': 121, 'path': 'spark_sql/sparksql_004.ipynb', 'repo_name': 'victorog17/soulcode_aulas_spark_databricks', 'size': '1474'}