Skip to content

Commit 9d56fca

Browse files
committed
Symmetric Pairs
Symmetric Pairs
1 parent 5d02e15 commit 9d56fca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Medium/Symmetric Pairs.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT distinct f1.x, f1.Y
2+
FROM functions f1
3+
INNER JOIN functions f2 ON (f1.x = f2.y and f2.x = f1.y)
4+
where f1.x<=f1.y
5+
Group by f1.x, f1.y
6+
Having COUNT(f1.X)>1 or f1.X<f1.Y
7+
ORDER BY f1.X

0 commit comments

Comments
 (0)