query-caddb9c1f295e3837d170c1e3b42c6c2
German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) German states, ordered by the number of company headquarters per million inhabitants
Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
Limits: states without population missing; company data in Wikidata is always incomplete
Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT ?state ?stateLabel ?companies ?population (?companies/?population1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count() as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279 wd:Q4830453 . ?company wdt:P159/wdt:P131 ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# German states, ordered by the number of company headquarters per million inhabitants
# Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country)
# Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data)
# Limits: states without population missing; company data in Wikidata is always incomplete
# Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified.
SELECT
?state ?stateLabel
?companies
?population
(?companies/?population*1000000 AS ?companiesPerM)
WHERE
{
{ SELECT ?state (count(*) as ?companies) WHERE {
{SELECT DISTINCT ?company ?state WHERE {
?state wdt:P31 wd:Q1221156 .
?company wdt:P31/wdt:P279* wd:Q4830453 .
?company wdt:P159/wdt:P131* ?state .
FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies
} }
} GROUP BY ?state }
?state wdt:P1082 ?population
SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
ORDER BY DESC(?companiesPerM)
Query found at
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/ar
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/be-tarask
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/ca
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/cs
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/da
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/de
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/en-gb
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/eo
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/es
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/eu
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/he
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/id
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/it
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/ja
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/ko
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/lb
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/lt
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/ms
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/pl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/pt-br
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/ro
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/ru
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/si
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/sv
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/th
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/tr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/vec
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/zh