A Query Language Is Also a Data Constraint Language
nchammas.comMathematically it's somewhat obvious that constraining the set of allowed relations is equivalent to defining a function from a relation to {true,false}. So I suppose it isn't too surprising that queries are equivalent to constraints.
That said for this most general definition for a relation over set X1, X2, ..., Xn the number of relations is 2^(X1 X2 ... Xn) so the number of constraints is even more ridiculous and would require at least 2^(X1 X2 ... Xn) bits to just enumerate them all, so it's pretty obvious that there can only be a small subset of constraints that can be represented efficiently.