Back Home
  • Examples
  • Sample Database
#1
SELECT 
    GROUP_CONCAT(country)
FROM
    customers;
#2
SELECT 
    GROUP_CONCAT(DISTINCT country)
FROM
    customers;
#3
SELECT 
    GROUP_CONCAT(DISTINCT country
        ORDER BY country)
FROM
    customers;
#4
SELECT 
    GROUP_CONCAT(DISTINCT country
        ORDER BY country
        SEPARATOR ';')
FROM
    customers;
#5
SELECT 
    employeeNumber, firstname, lastname, customername
FROM
    employees
        INNER JOIN
    customers ON customers.salesRepEmployeeNumber = employees.employeeNumber
ORDER BY firstname , lastname;
#6
SELECT 
    employeeNumber,
    firstName,
    lastName,
    GROUP_CONCAT(DISTINCT customername
        ORDER BY customerName)
FROM
    employees
        INNER JOIN
    customers ON customers.salesRepEmployeeNumber = employeeNumber
GROUP BY employeeNumber
ORDER BY firstName , lastname;
#7
SELECT 
    GROUP_CONCAT(CONCAT_WS(', ', contactLastName, contactFirstName)
        SEPARATOR ';')
FROM
    customers;
#8
SELECT 
    GROUP_CONCAT(DISTINCT country
        SEPARATOR ';')
FROM
    customers
ORDER BY country;
Table List
customers
SELECT * FROM customers;
employees
SELECT * FROM employees;
offices
SELECT * FROM offices;
orderdetails
SELECT * FROM orderdetails;
orders
SELECT * FROM orders;
payments
SELECT * FROM payments;
productlines
SELECT * FROM productlines;
products
SELECT * FROM products;
  • SQL Query
Execute
Clear Beautify Minify
  • Result