Something like: WITH stuff AS ( SELECT bday, carcolor, ROW_NUMBER() OVER ( PARTITION BY bday,carcolor ORDER BY bday,carcolor ) rownum FROM friends ) SELECT * FROM stuff WHERE rownum > 1;
Something like: WITH stuff AS ( SELECT bday, carcolor, ROW_NUMBER() OVER ( PARTITION BY bday,carcolor ORDER BY bday,carcolor ) rownum FROM friends ) SELECT * FROM stuff WHERE rownum > 1;
select f1.id, f2.id from friends f1, friends f2 where f1.bday = f2.bday and f1.carcolor = f2.carcolor and f1.id > f2.id;
Similarly, don't expect that a single data model will suffice for all needs in an application. Expect to have to maintain anything that is useful.
Even having them in several tables is not rocket science, OP was just trying to give an easy example of types of queries that are easier with datomic than with sql.
Yes, this is a large part of why we use databases. They will do most of this heavy lifting. However, I don't think it changes the game. If you want some access to be easy or quick, you have to maintain the data in that format.