175. Combine Two Tables
All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : May 22, 2024
Last updated : July 01, 2024
Related Topics : Database
Acceptance Rate : 76.91 %
import pandas as pd
def combine_two_tables(person: pd.DataFrame, address: pd.DataFrame) -> pd.DataFrame:
return pd.merge(left=person, right=address, how='left', on='personId')[['firstName', 'lastName', 'city', 'state']]
SELECT firstName, lastName, city, state
FROM Person LEFT OUTER JOIN Address ON Person.personId = Address.personId;