বিষয়সূচী

01

কেন CONCAT()?

১৫ মিনিট
employee_idfirst_namelast_name
101RahimKhan
102KarimHossain
103JannatAhmed
জিজ্ঞেস

দুই column আলাদা — HR চায় Rahim Khan। কীভাবে একসাথে দেখাব?

first_name + last_name → Full Name
CONCAT() = একাধিক value জুড়ে একটি combined text/value তৈরি করে।
02

Real-life Examples

১০ মিনিট
Rahim + Khan → Rahim Khan 12 + Dhanmondi + Dhaka → 12 Dhanmondi Dhaka Apple + iPhone + 15 → Apple iPhone 15 101 + Rahim Khan → 101 - Rahim Khan C001 + Rahim → C001 - Rahim Multiple Values → CONCAT() → One Combined Result
03

CONCAT() কী?

১০ মিনিট
CONCAT(value1, value2, value3, ...)
CONCAT() │ Value 1 · Value 2 · Value 3 ↓ Combined Result

Function name · parentheses · values · comma · অনেক argument।

04

প্রথম উদাহরণ

১০ মিনিট
SELECT CONCAT('Hello', 'World');
HelloWorld
SELECT CONCAT('Hello', ' ', 'World');
Hello World
Space নিজেও একটা value — CONCAT()-এ আলাদা দিয়ে দিতে হয়।
05

Table Columns

১৫ মিনিট
CREATE TABLE employees ( employee_id INT, first_name VARCHAR(50), last_name VARCHAR(50) ); INSERT INTO employees VALUES (101,'Rahim','Khan'), (102,'Karim','Hossain'), (103,'Jannat','Ahmed'), (104,'Sakib','Hasan'), (105,'Nadia','Rahman');
SELECT CONCAT(first_name, last_name) FROM employees;
RahimKhan · KarimHossain · …
সমস্যা?

মাঝে space নেই।

SELECT CONCAT(first_name, ' ', last_name) FROM employees;
Rahim Khan · Karim Hossain · …
06

অনেক Argument

১০ মিনিট
SELECT CONCAT( 'Employee: ', employee_id, ' - ', first_name, ' ', last_name ) AS employee_info FROM employees;
Employee: 101 - Rahim Khan Employee: 102 - Karim Hossain
'Employee: ' + id + ' - ' + first + ' ' + last → Final
07

Text + Column + Number

১০ মিনিট
SELECT CONCAT('Employee ID: ', employee_id) AS employee_id_label FROM employees; SELECT CONCAT( 'Employee ', employee_id, ': ', first_name ) AS employee_label FROM employees;
Employee ID: 101 Employee 101: Rahim
08

Custom Separators

১০ মিনিট
Useful separators: ' ' ', ' ' - ' ' | ' ': ' '/'
SELECT CONCAT(first_name, ' ', last_name) FROM employees; SELECT CONCAT(first_name, ' - ', last_name) FROM employees; SELECT CONCAT(first_name, ' | ', last_name) FROM employees; SELECT CONCAT(first_name, ': ', last_name) FROM employees;
CONCAT() নিজে separator বানায় না — আমাদের দিতে হয়।
09

৩, ৪, ৫+ Values

১০ মিনিট
SELECT CONCAT(first_name, ' ', last_name, ' - Employee') FROM employees; SELECT CONCAT(first_name, ' ', last_name, ' - ', employee_id) FROM employees; SELECT CONCAT( house_no, ', ', road, ', ', area, ', ', city, ', ', country ) AS full_address FROM customers;
বাম থেকে ডানে argument ধরে জোড়ে।
10

Alias (সংক্ষেপ)

৫ মিনিট
SELECT CONCAT(first_name, ' ', last_name) AS full_name FROM employees;
Without alias → ugly column name With alias → full_name (report-friendly)
11

Business Reports

১০ মিনিট
DomainCONCAT ideaPurpose
HRfirst + ' ' + lastFull name
E-combrand + ' ' + product + ' ' + modelDisplay name
Supportid + ' - ' + nameCustomer label
Bankcode + ' - ' + branchBranch label
Hospitalid + ' - ' + patientPatient label
Logisticsorder + ' - ' + trackingTracking label
12

Full Address Lab

১০ মিনিট
customer_idhouseroadareacity
112Road 5DhanmondiDhaka
225Road 2BananiDhaka
SELECT CONCAT( house, ', ', road, ', ', area, ', ', city ) AS full_address FROM customers;
12, Road 5, Dhanmondi, Dhaka 25, Road 2, Banani, Dhaka
13

Product Label

১০ মিনিট
brandproductmodel
AppleiPhone15
SamsungGalaxyS24
DellInspiron15
SELECT CONCAT(brand, ' ', product, ' ', model) AS product_label FROM products;
Apple iPhone 15 Samsung Galaxy S24 Dell Inspiron 15
14

Generated Messages

১০ মিনিট
SELECT CONCAT( 'Hello ', first_name, ', welcome to our company!' ) AS message FROM employees; SELECT CONCAT( 'Employee ', employee_id, ' is ', first_name, ' ', last_name ) AS message FROM employees;
Hello Rahim, welcome to our company! Employee 101 is Rahim Khan
15

CONCAT + Expression

১০ মিনিট
SELECT CONCAT( 'Employee ID: ', employee_id + 1000 ) AS new_label FROM employees;
এখানে ফোকাস CONCAT — arithmetic আলাদা পাঠ নয়।
16

Predict the Output (১৫)

১০ মিনিট
Predict: CONCAT('Data','Science')
DataScience
Predict: CONCAT('Data',' ','Science')
Data Science
Predict: CONCAT('SQL',' ','Class',' ','2026')
SQL Class 2026
Predict: CONCAT('A','-','B')
A-B
Predict: CONCAT('A',' | ','B')
A | B
Predict: CONCAT('Hi ',first) if first=Rahim
Hi Rahim
Predict: CONCAT(101,' - ',name) name=Rahim
101 - Rahim
Predict: CONCAT(first,last) Rahim+Khan
RahimKhan
Predict: CONCAT(first,' ',last)
Rahim Khan
Predict: CONCAT('ID:',employee_id) id=101
ID:101
Predict: CONCAT('ID: ',employee_id)
ID: 101
Predict: CONCAT('X',', ','Y')
X, Y
Predict: CONCAT('Hello','','World')
HelloWorld (empty string)
Predict: 4 values 'A',' ','B','!'
A B!
Predict: CONCAT('Emp ',id,': ',first) 101 Rahim
Emp 101: Rahim
17

Find the Mistake (১০)

১০ মিনিট
Bug: CONCAT(first_name last_name)
Comma missing between args
Bug: CONCAT('first_name','last_name')
Quotes → literal text, not columns
Bug: CONCAT(first_name ' ' last_name)
Missing commas around space
Bug: CONCAT(first_name, last_name) no space
Forgot ' ' separator
Bug: CONCAT(first_name,,last_name)
Empty/extra comma confuse
Bug: CONCAT first_name, last_name)
Missing opening (
Bug: CONCAT(first_name, ' -' last_name)
Missing comma after separator
Bug: CONCAT(first_name, '-', -, last_name)
Invalid bare hyphen
Bug: alias missing for report
Add AS full_name
Bug: CONCAT(first_name, ' ', last_name) too many spaces?
Check separator — maybe want single space
18

CONCAT Mistakes

৮ মিনিট
  1. Comma ভুলে
  2. Fixed text-এ quotes ভুলে
  3. Space value ভুলে
  4. Column নাম quotes-এ
  5. Parentheses ভুল
  6. Separator ভুল জায়গায়
  7. অপ্রয়োজনীয় separator
  8. অনেক confusing argument
  9. খারাপ alias
  10. Output না চেক করা
Pattern
Wrong → Why? → Correct → Expected
19

Pattern Library

৮ মিনিট
Full Name: CONCAT(first_name, ' ', last_name) ID + Name: CONCAT(employee_id, ' - ', first_name) ID + Full: CONCAT(employee_id, ' - ', first_name, ' ', last_name) Product: CONCAT(brand, ' ', product, ' ', model) Address: CONCAT(house, ', ', road, ', ', city) Status: CONCAT('Status: ', status) Greeting: CONCAT('Hello ', first_name) Report: CONCAT('Total Sales: ', total_sales)
20

Mini Project — Label Generator

১৫ মিনিট

২০+ employees: employee_id, first_name, last_name, department, designation, city।

  1. Full name
  2. 101 - Rahim Khan
  3. Rahim Khan | Software Engineer | IT
  4. Rahim Khan | Dhaka
  5. EMP-101 | Rahim Khan | Software Engineer | Dhaka
  6. Hello Rahim Khan!
  7. Department: IT
SELECT CONCAT(first_name, ' ', last_name) AS full_name, CONCAT(employee_id, ' - ', first_name, ' ', last_name) AS id_name, CONCAT(first_name, ' ', last_name, ' | ', designation, ' | ', department) AS profile_label, CONCAT('EMP-', employee_id, ' | ', first_name, ' ', last_name, ' | ', designation, ' | ', city) AS complete_label, CONCAT('Hello ', first_name, ' ', last_name, '!') AS greeting, CONCAT('Department: ', department) AS dept_label FROM employees;
21

Professional Thinking

৮ মিনিট
What info do I have? → Which values together? → What separator? → Write CONCAT() → Correct order → Readable alias → Check output
22

Interview (২০)

১২ মিনিট
IV 1. CONCAT কী?
একাধিক value জোড়া · উদা: full name · ইউজ: labels
IV 2. কেন ব্যবহার?
আলাদা column একসাথে দেখাতে · ফলো: separator · ইউজ: reports
IV 3. First+last?
CONCAT(first,' ',last)
IV 4. Space কীভাবে?
' ' হিসেবে আলাদা argument
IV 5. Number + string?
হ্যাঁ — CONCAT মিলিয়ে দেয়
IV 6. কত value?
একাধিক (MySQL অনেক argument নেয়)
IV 7. Column quotes-এ?
Literal text হয় — column নয়
IV 8. Full address?
CONCAT(house,', ',road,', ',city)
IV 9. Product label?
CONCAT(brand,' ',product,' ',model)
IV 10. Employee label?
CONCAT(id,' - ',first,' ',last)
IV 11. Comma কেন?
Arguments আলাদা করতে
IV 12. Quotes কেন?
Fixed text চিহ্নিত করতে
IV 13. Hyphen?
CONCAT(a,' - ',b)
IV 14. Comma separator?
CONCAT(a,', ',b)
IV 15. Greeting?
CONCAT('Hello ',first_name)
IV 16. ৫ column?
প্রতিটি + separator বাম→ডান
IV 17. Report-এ?
readable label columns
IV 18. Value vs column?
quotes=literal · no quotes=column
IV 19. Readable output?
separator + AS alias
IV 20. Real use?
HR name, e-com title, ticket labels
23

MCQ (২০)

১০ মিনিট
MCQ 1. CONCAT does? A) sort B) join values C) delete D) count
B
MCQ 2. CONCAT('A','B')? A) A B B) AB C) A,B D) error
B
MCQ 3. Space how? A) automatic B) pass ' ' C) TRIM D) JOIN
B
MCQ 4. Missing comma? A) OK B) syntax error/wrong C) auto-fix D) NULL
B
MCQ 5. 'first_name' in quotes? A) column B) literal text C) number D) table
B
MCQ 6. CONCAT(first,last) Rahim Khan →? A) Rahim Khan B) RahimKhan C) error D) NULL
B
MCQ 7. Separator built-in? A) yes always B) no — you pass it C) only comma D) only space
B
MCQ 8. Can mix number? A) no B) yes C) only INT D) only FLOAT
B
MCQ 9. Alias role? A) rename result col B) join tables C) delete D) sort
A
MCQ 10. CONCAT(a,' - ',b)? A) a-b B) a - b C) a,b D) ab
B
MCQ 11. CONCAT(a,' | ',b)? A) a|b B) a | b C) a,b D) ab
B
MCQ 12. Order of args? A) right→left B) left→right C) random D) alpha
B
MCQ 13. Full name pattern?
CONCAT(first,' ',last)
MCQ 14. ID label pattern?
CONCAT(id,' - ',name)
MCQ 15. Address commas?
CONCAT(h,', ',r,', ',c)
MCQ 16. Greeting?
CONCAT('Hello ',first)
MCQ 17. Product 3 parts?
CONCAT(brand,' ',product,' ',model)
MCQ 18. Expression inside? A) never B) allowed e.g. id+1000 C) only SUM D) only JOIN
B
MCQ 19. Focus of this class? A) TRIM B) CONCAT only C) LIKE D) JOIN
B
MCQ 20. Check output why?
Verify separators/order before using in reports
24

Classroom Practice (১৫)

১২ মিনিট
Ex 1 — Join two fixed texts
SELECT CONCAT('Hello','World')
Ex 2 — First + last
CONCAT(first_name,last_name)
Ex 3 — Add space
CONCAT(first_name,' ',last_name)
Ex 4 — Add hyphen
CONCAT(first_name,' - ',last_name)
Ex 5 — Add comma
CONCAT(city,', ',country)
Ex 6 — Three columns
CONCAT(a,' ',b,' ',c)
Ex 7 — Four columns
CONCAT(a,' ',b,' - ',c,' ',d)
Ex 8 — Text + number
CONCAT('ID: ',employee_id)
Ex 9 — Employee label
CONCAT(employee_id,' - ',first_name,' ',last_name)
Ex 10 — Product label
CONCAT(brand,' ',product,' ',model)
Ex 11 — Full address
CONCAT(house,', ',road,', ',area,', ',city)
Ex 12 — Customer label
CONCAT(customer_id,' - ',customer_name)
Ex 13 — Profile label
CONCAT(first,' ',last,' | ',designation,' | ',department)
Ex 14 — Greeting
CONCAT('Hello ',first_name,' ',last_name,'!')
Ex 15 — Business report label
CONCAT('EMP-',id,' | ',first,' ',last,' | ',city)
25

Cheat Sheet + Memory Map

৫ মিনিট
CONCAT() → একাধিক value একসাথে CONCAT(a, b) → a + b CONCAT(a, ' ', b) → a + space + b CONCAT(a, ' - ', b) → a + hyphen + b CONCAT(a, ', ', b) → a + comma + b CONCAT() TEXT · COLUMN · NUMBER ↓ Optional Separator (you provide) ↓ Combined Result → NAME / ADDRESS / LABEL
CONCAT() = একাধিক value-কে একসাথে জোড়া লাগানো।
TRIM / LOWER / CONCAT_WS / LIKE ইত্যাদি — অন্য module-এর বিষয়।