sql group by
2024-02-15 17:11:23
```sql
SELECT artist, COUNT(*) as total_artworks
FROM artworks
GROUP BY artist;
```
這將返回每個藝術(shù)家的總藝術(shù)品數(shù)量。
```sql
SELECT device_type, COUNT(*) as total_devices
FROM storage_devices
GROUP BY device_type;
```
```sql
SELECT origin_city, COUNT(*) as total_bookings
FROM bookings
GROUP BY origin_city;
```
```sql
SELECT design_style, COUNT(*) as total_orders
FROM furniture_orders
GROUP BY design_style;
```