---
title: "SQL: customer name and address"
subject: "Database Management System"
chapter: 3
key: "semester_6/database_management_system:sql-customer-name-address"
source: https://www.bctengineer.com/q/semester_6/database_management_system/sql-customer-name-address
site: BCT Engineering
---

# SQL: customer name and address

Database Management System · Chapter 3: Relational Languages & Relational Model

- Asked in: year not given
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/database_management_system/sql-customer-name-address
- Whole chapter: https://www.bctengineer.com/md/semester_6/database_management_system/chapter-3

## Question

Consider database schema:
Account (acc_no, branch_name, balance)
Branch (branch_name, branch_city, assets)
Customer (customer_name, customer_street, customer_city)
Loan (loan_no, branch_name, amount)
Depositor (customer_name, acc_no)
Borrower (customer_name, loan_no)
List name and address of customer. (address = street, city)

## Short answer

Select customer_name, customer_street, customer_city from Customer; concatenate street and city with || ', ' to form address.

## Answer

Name and address both come from the `Customer` table, where the address is made of street and city. No join is needed.

```sql
SELECT customer_name, customer_street, customer_city
FROM   Customer;
```

To show the address as a single column, concatenate the two attributes (`||` in standard SQL/Oracle/SQLite; `CONCAT()` in MySQL):

```sql
SELECT customer_name,
       customer_street || ', ' || customer_city AS address
FROM   Customer;
```

**Relational algebra:** Π customer_name, customer_street, customer_city (Customer)

**Sample output:**

| customer_name | address |
|---|---|
| Sujan | S1, Dharan |
| Ram | S2, Pokhara |

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why no join is needed?
   A. Needs Depositor
   B. Needs Branch
   C. Needs Account
   D. Name, street and city are all in Customer
   Answer: D. All attributes in one table. (Key point: Single table)

2. How to show address as one column?
   A. customer_street + customer_city in WHERE
   B. customer_street || ', ' || customer_city AS address
   C. GROUP BY
   D. DISTINCT
   Answer: B. || concatenates; CONCAT() in MySQL. (Key point: Concatenation)

3. Relational algebra equivalent?
   A. σ on Customer
   B. Customer ⋈ Depositor
   C. Customer - Depositor
   D. π customer_name, customer_street, customer_city (Customer)
   Answer: D. Projection selects columns. (Key point: Algebra)

## Close variants set in other exams

- [SQL: number of accounts per branch](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-count-accounts-branch) — Database Management System, chapter 3
- [SQL: customer names beginning with su](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-customer-name-like-su) — Database Management System, chapter 3
- [SQL: branch city with assets over 1000000](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-branch-assets-million) — Database Management System, chapter 3
- [SQL: customer, branch, account details](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-natural-join-details) — Database Management System, chapter 3
- [SQL: branches with avg balance over 50000](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-avg-balance-branch) — Database Management System, chapter 3
- [SQL: customers with account in Dharan](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-customers-dharan-branch) — Database Management System, chapter 3
- [SQL: create and use bank database](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-create-database-bank) — Database Management System, chapter 3

## Related in Database Management System

- [SQL: create tables for bank schema](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-create-tables-bank) — Database Management System, chapter 3
- [SQL: increase balances by 100% and 50%](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Asql-update-balance-rates) — Database Management System, chapter 3
- [RA: count accounts in each branch](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Ara-count-accounts-branch) — Database Management System, chapter 3
- [RA: delete loans under 1000](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Ara-delete-small-loans) — Database Management System, chapter 3
- [RA: increase loans over 10000](https://www.bctengineer.com/question.md?key=semester_6%2Fdatabase_management_system%3Ara-increase-loan-10) — Database Management System, chapter 3
