The avg salary of peers expects the employee itself(that is, for each employee its peer would be everyone in the same department as the employee but excluding the employee himself). We have two …
Tag: database
MySQL: Select only if field values are ascending
I have two tables: Route and Stop (one to many). And also I have input data: two location IDs which is related to ‘stop’ table. Every route has it’s own ORDERED list of stops. I need to select Route …
Service that does advanced queries on a data set, and automatically returns relevant updated results every time new data is added to the set?
I’m looking for a cloud service that can do advanced statistics calculations on a large amount of votes submitted by users, in “real time”. In our app, users can submit different kind of votes like …
Select a conversation between exact users (by users IDs)
I’m woking on a simple chat app. It should allow users to run conversations user-to-user or in groups (multiple users). So here are my tables: table users ID | username | … table …
How to check if column has value if another column is populated in SQL Server?
I am trying to find a way to see if I can write a query to check a table to return any row that is missing a dependency if that makes sense. For example let’s say I have the following columns: …
How to build an index that is best for this SQL?
I’m querying database by a simple SQL like: SELECT DISTINCT label FROM Document WHERE folderId=123 I need a best index for it. There are two way to implement this. (1) create two indexes CREATE …
How do I compare two SQL queries to run on Postgres
I need to compare two queries that will run in my Postgres database. How do I know the execution time and any other statistics of them so I can produce a reliable benchmark between them? Answer I can think of two interesting data points to collect and compare: The execution time. For that, simply execute the query using psql connected
How to retrieved parent object which haven’t children with specific values? Sequelize
Description & question Rentals is table with all registered rentals with start and end date as properites. After querying i want to get only this productGroups which have some products that don’t …
How can I ‘flatten’ a one to many table with URLs so that each additional URL shows up in a new column?
I’m trying to ‘flatten’ a one to many relationship using SQL to create a CSV of points and their associated photos to use with a web map. Table 1 is a list of points and their locations, and Table 2 …
PostgreSQL – Help comparing two tables against three specific columns
I need to match three columns across two tables. A query should select a row in t1 and search for any row in t2 where ALL three columns listed below match. tbl_staged_documentation (t1 for reference)…