LeetCode 196. Delete Duplicate Emails
Tutd Schema:
person :: {id Integer, email Text};
person := relation{tuple{id 1, email "join@example.com"},
tuple{id 2, email "bob@example.com"},
tuple{id 3, email "join@example.com"}};
Thinking Process:
TutorialD (master/main): person := ((person group ({all but email} as ids):{minId := min(@ids)}){all but ids}) rename {minId as id}
TutorialD (master/main): :showexpr person
┌──────────────────┬───────────┐
│email::Text │id::Integer│
├──────────────────┼───────────┤
│"bob@example.com" │2 │
│"join@example.com"│1 │
└──────────────────┴───────────┘
留言
張貼留言