Some customers don't have a company. Use COALESCE to show 'Individual' for customers without a company.
Write a query showing customer names and their company, with 'Individual' for those without one.
| Column | Type |
|---|---|
| CustomerId | INTEGER (Primary Key) |
| FirstName | TEXT |
| LastName | TEXT |
| Company | TEXT |
| Address | TEXT |
| City | TEXT |
| State | TEXT |
| Country | TEXT |
| PostalCode | TEXT |
| Phone | TEXT |
| Fax | TEXT |
| TEXT | |
| SupportRepId | INTEGER (Foreign Key → Employee.EmployeeId) |
COALESCE(x, y, ...) returns the first non-NULL argument. It's standard SQL and works in PostgreSQL, MySQL, and most other databases.
Ready to take your skills to the next level? Enroll in our comprehensive Data Analyst Career Track to master SQL, Python, Excel, and Power BI.
Run your code to see the result here.