# Locations and Companies

Each entry in the `locations` table can optionally reference a company via `company_id`. This column links a location to the `companies` table allowing multi-company setups where different locations belong to different legal entities.

Use this relationship to filter employees, time clocks and procurement requests by company context. A basic query to show the link is:

```sql
SELECT l.name AS location, c.name AS company
FROM locations l
LEFT JOIN companies c ON l.company_id = c.id;
```

Employees may still be assigned to multiple locations through `employees2locations` and `employee_authorized_locations`.

