Menu
  • HOME
  • TAGS

SQL scalar subquery checking a row was found

sql-server-2008,tsql,join,cardinality,scalar-subquery

In MSSQL it appears that isnull only evaluates its second argument if the first is null. So in general you can say select isnull(x, 0/0) to give a query which returns x if non-null and dies if that would give null. Applying this to a scalar subquery, select 42, isnull((select...

Create a random string of a given cardinality

java,random,cardinality

This can be done by using Random and nextInt(<#differentChars>) to get an int in the range of different characters you want to support. Then you need to convert this number to a String and add it to the result, repeat "desiredLength" times. To convert the number to a String you...

Elasticsearch Cardinality Aggregation giving completely wrong results

elasticsearch,aggregation,cardinality

Your aggregation is returning the global value for the cardinality. If you want it to return only the cardinality of the filtered set, one way you could do that is to use a filter aggregation, then nest your cardinality aggregation inside that. Leaving out the filtered query for clarity (you...

Elasticsearch cardinality sorted wrong

sorting,elasticsearch,aggregation,cardinality

If you are trying to sort by a 2-levels deep sub-aggregation, the order syntax is slightly different according to the documentation (look at the end of the paragraph). It is also explained more clearly in this part of the ElasticSearch Definitive Guide. In your case, something like this should do...

Protege exactly 1 cardinality OWL restriction not raising an inconsistency

owl,protege,restrictions,cardinality

There's no inconsistency in the first case. OWL makes the open world assumption, which means that something being unknown is different from it being known to be true or known to be false. Your username, at the time I'm writing this answer is user3552593. I'm relatively confident that you have...

Cardinality Confusion

mysql,sql,database,data-modeling,cardinality

Your description is a little vague, but my impression is that you have three key entities: Awards GroupOfPersons Persons An award goes to a group of people. So, the relationship between an "award" and a "group of persons" is 1-many (one award goes to only one group, one group could...

Cardinality restrictions on SPARQL

rdf,sparql,restrictions,rdfs,cardinality

Now, I want to query all parents, for example, with at least two children (cardinality on hasChild relation) with SPARQL. You just select a parent and child in each row, then group by the parent, and then only take those that have at least two values for child: select...

Cypher relationship cardinality

neo4j,cypher,cardinality

Not sure if this will work, and I don't have 1.9 running at the moment, but it has worked like this in the past. START n=node(2) MATCH (n)-->(m) WHERE length((m)-->()) = 1 RETURN m ...

Simple cardinality estimation algorithm

algorithm,unique,probability,cardinality,hyperloglog

HyperLogLog itself is quite simple, once you understand it (and already have a hash function). I have implemented a didactic version in Python with 5 lines for element insertion and another 6 lines for estimation: from mmhash import mmhash from math import log from base64 import b64encode class HyperLogLog: def...