Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Ändern Sie die Abfrage aus „Übung 8-1“ so, dass sie die Konten pro Kunden zählt. Zeigen Sie für jeden Kunden die Kundennummer (Customer ID) und die Anzahl der Konten an.
mysql> SELECT cust_id, COUNT(*) -> FROM account -> GROUP BY cust_id; +---------+----------+ | cust_id | count(*) | +---------+----------+ | 1 | 3 | | 2 | 2 | | 3 | 2 | | 4 | 3 | | 5 | 1 | | 6 | 2 | | 7 | 1 | | 8 | 2 | | 9 | 3 | | 10 | 2 | | 11 | 1 | | 12 | 1 | | 13 | 1 | +---------+----------+ 13 rows in set (0.00 sec)