/* Grouping and Concatenating string values for an entire column  */

/* POSTGRESQL only */


SELECT  vendor,  STRING_AGG(description, ',  ' ORDER BY description), SUM(amount) as "total"
FROM  payment 
GROUP BY vendor;


SELECT lname, fname, STRING_AGG(course_id ||'--'||class_id, ', ' ORDER BY course_id DESC) as "courses", COUNT(course_id)   
FROM student JOIN class ON ssn=stu_ssn
GROUP BY lname, fname;