Skip to content

Tag: sql

TSQL find number of correspondences

I have the following table: Test Data: I need to find out how many times correspondence has been between each pair. For example, Anthony has contacted John 5 times, John has contacted Anthony 5 times. So total correspondence between John and Anthony has been 10 times. Similarly, David has contacted John total of 9 times, John has contacted David 4

How to convert some queries from sql to sparql?

I am just learning Sparql and I have the following tables: Countries, European Country, City and Capital I would like to know how to make the following queries, because I didnt understand them… 1) Which country has the city “Paris” as capital. 2) Print all the European Countries 3) Print all the countries and theis capitals. Thank you very much

Alternative to BigQuery for medium-sized data

This is a follow-up to the question Why doesn’t BigQuery perform as well on small data sets. Let’s suppose I have a data-set that is ~1M rows. In the current database that we’re using (mysql) aggregation queries would run quite slow, perhaps taking ~10s or so on complex aggregations. On BigQuery, the initialization time required might make this query take

How to simplify nested select in where clause?

I have 4 tables EMPLOYEE, COMPANY, WORKS and MANAGES. The tables are defined as follows- I need to find all the employees who live in the same city as the company for which they work. So far I have done this. It’s working fine. But I want to know is there any simpler way to do this query? Answer You

How to compare two columns in the CASE statement

I have two columns Speed_A and Speed_B. Now I will compare both columns and will select the higher one in a new table. Something like this: How does it work? Answer Assuming your speeds are numerically typed you might get this as easy as: Your ELSE will only occur, when A and B are equal, In this case it doesn’t