FAQ Database Discussion Community

## Best SQL query to get unique sets from below table

sql,oracle,set-theory
I have a below table Select X,Y from T X | Y ------ 1 | 2 1 | 3 2 | 1 3 | 5 3 | 1 Column X and Y holds Strings, I gave numbers just for example. I need output from this table as below 1,2 1,3...

## How to match a set against a set of sets, completely

mapping,combinatorics,computation-theory,np-complete,set-theory
This problem is similar to the "Exact Hitting Set" problem (http://en.wikipedia.org/wiki/Exact_cover#Exact_hitting_set) but with slightly different constraints. I am looking for libraries, implementations, or papers that solve the following. Say I have a set of sets S, and is initialized as follows: S = {N, O, P, E}; N = {1,...

## Determine all consecutive subsets of the set {1,2,3,…,n}. The subsets should have at least 2 elements

algorithm,computer-science,combinatorics,set-theory
I need to partition a set S={1, 2, 3, … , n} consisting of consecutive numbers such that each subset has has at least 2 elements (rule 1) and it consists of consecutive numbers (rule 2). The rules are: Each subset has at least two elements. All elements of all...

## Unexpected behaviour in Python OrderedSet.issuperset()

python,set,set-theory
I have two OrderedSets and I'm trying to check whether one in a subset of the other - both the elements and their order is important. However, the orderedset package is giving me strange results. >>> import orderedset >>> a = orderedset.OrderedSet([433, 316, 259]) >>> b = orderedset.OrderedSet([433, 316, 69])...

## I want to use the django ORM to get a complement from two tables

python,django,orm,django-queryset,set-theory
I aready have checked this question Getting complement of queryset. But, it didn't work. It seems like it's only extracting one field in the result. I have the following two tables: table A 001 a 002 b 003 C table B 001 a 002 b 003 c 004 d 005...

## In the category of sets, why are singleton sets terminal?

category-theory,set-theory
I'm trying to understand why the category of sets is defined the way it is, with singleton sets as terminal objects. If the "Set" category contains all of the possible sets, and all of the possible morphisms between those sets, why wouldn't there be injective, non-surjective morphisms from the singleton...