Leetcode Problem 175. Combine Two Tables

175. Combine Two Tables

Leetcode Solutions

Combining Person and Address Information

  1. Perform a left join between the Person and Address tables using the personId column as the join key.
  2. Select the firstName, lastName, city, and state columns to be included in the final result.
  3. Handle cases where there is no corresponding address information by allowing city and state to be null.
  4. Return the result set with the desired columns in any order.
erDiagram
    Person ||--o{ Address : has
    Person {
        int personId PK
        varchar lastName
        varchar firstName
    }
    Address {
        int addressId PK
        int personId FK
        varchar city
        varchar state
    }

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...