我有一列包含物种列表的字符串:
+----------------------------------------+
| species |
+----------------------------------------+
| Dinosauria, Ornitischia, indeterminado |
| Sirenia |
| Dinosauria, Therophoda |
| Dinosauria, Therophoda, Allosaurus |
| and so on... |
+----------------------------------------+
我正在寻找一种在 PostgreSQL 12 中列出和计算所有唯一名称的方法,例如:
+---------------+-------+
| species | count |
+---------------+-------+
| Dinossauria | 3 |
| Ornitischia | 1 |
| indeterminado | 1 |
| Sirenia | 1 |
| Theropoda | 2 |
| Allosaurus | 1 |
+-----------------------+