- Year not given
SQL: customer name and address
Short answer
Select customer_name, customer_street, customer_city from Customer; concatenate street and city with || ', ' to form address.
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)
Name and address both come from the Customer table, where the address is made of street and city. No join is needed.
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):
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 |
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- SQL: number of accounts per branch · Database Management System, chapter 3
- SQL: customer names beginning with su · Database Management System, chapter 3
- SQL: branch city with assets over 1000000 · Database Management System, chapter 3
- SQL: customer, branch, account details · Database Management System, chapter 3
- SQL: branches with avg balance over 50000 · Database Management System, chapter 3
- SQL: customers with account in Dharan · Database Management System, chapter 3
- SQL: create and use bank database · Database Management System, chapter 3
- SQL: create tables for bank schema · Database Management System, chapter 3
- SQL: increase balances by 100% and 50% · Database Management System, chapter 3
- RA: count accounts in each branch · Database Management System, chapter 3
- RA: delete loans under 1000 · Database Management System, chapter 3
- RA: increase loans over 10000 · Database Management System, chapter 3