I want to find different pairs of names in a table that have the same exact elements in the items column. For instance:
CREATE TABLE t ( name VARCHAR(255), item VARCHAR(255) ); INSERT INTO t VALUES("Alice", "Orange"); INSERT INTO t VALUES("Alice", "Pear"); INSERT INTO t VALUES("Alice", "Lemon"); INSERT INTO t VALUES("Bob", "Orange"); INSERT INTO t VALUES("Bob", "Pear"); INSERT INTO t VALUES("Bob", "Lemon"); INSERT INTO t VALUES("Charlie", "Pear"); INSERT INTO t VALUES("Charlie", "Lemon");
The answer here will be Alice,Bob , because they took the same elements.
I want to do this with double negation (using NOT EXISTS / NOT IN), which I think is more suitable for this question, but I could not come up with anything that would be close to functionality.
This seems like this question , but I'm using SQLite, so I can't use GROUP_CONCAT () , but I was wondering how to do this using relational division, using NOT EXISTS / NOT IN.
source share