Questions tagged [query]

Database and dataset queries, using existing query features with well identified criteria. If the criteria to find the data are unclear, the [search] tag is preferred.

A query is an interaction with a database (or a comparable dataset) with the goal of finding specific data on the base of well identified criteria. Queries are made with existing query features/functions or query languages.

This topic is about:

  • query specification
  • query languages and functions/features
  • query optimisation
  • design patterns for implementing queries

Disambiguation

Use for questions that could be related to queries, but when the criteria to be used to find the data are not completely identified.

Use for questions related specifically to jQuery.

Use for the graph exploration and graph traversal algorithms (e.g. breadth first, depth first, A*, ...).

72 questions
49
votes
12 answers

Why don't relational databases support returning information in a nested format?

Suppose I'm building a blog that I want to have posts and comments. So I create two tables, a 'posts' table with an autoincrementing integer 'id' column, and a 'comments' table that has a foreign key 'post_id'. Then I want to run what will probably…
41
votes
6 answers

How do I make complex SQL queries easier to write?

I'm finding it very difficult to write complex SQL queries involving joins across many (at least 3-4) tables and involving several nested conditions. The queries I'm being asked to write are easily described by a few sentences, but can require a…
bwDraco
  • 568
  • 1
  • 6
  • 13
35
votes
12 answers

Should experienced programmers know database queries?

There are so many programmers out there who are also an expert at Query writing and Database design. Should this be a core requirement to be an expert programmer or software engineer? Though there are lots of similarities in the way queries and…
Shamim Hafiz - MSFT
  • 4,123
  • 7
  • 38
  • 46
20
votes
3 answers

Why would I use ElasticSearch if I already use a graph database?

I don't find any deep explanation on the web about a comparison between ElasticSearch and the graph databases. Both are optimized to traverse data. ElasticSearch seems to be optimized for analytics. However Neo4j is also based on Lucene to manage…
Mik378
  • 3,838
  • 7
  • 33
  • 60
7
votes
3 answers

DB Queries in code or use Stored Procedures

Some of my colleagues tells me that using stored procedures in the database adds to much business logic in the database, and that you should keep the data separate from logic. Other colleagues tells me that adding DB Queries in source code as…
Benny Skogberg
  • 370
  • 5
  • 20
7
votes
3 answers

What is selection and what is projection

I am working on Android with the query() method of the ContentResolver class and it accepts 6 parameters, (uri,projection,selection,selectionArgs,sortOrder,cancellationSignal) for selection and projection parameters. I am little bit confused with…
6
votes
6 answers

Should I have a separate method for Update(), Insert(), etc., or have a generic Query() that would be able to handle all of these?

I'm currently trying to write a class library for a connection to a database. Looking over it, there are several different types of queries: Select From, Update, Insert, etc. My question is, what is the best practice for writing these queries in…
PiousVenom
  • 247
  • 2
  • 9
5
votes
2 answers

Preferred approach to a matching process

I am currently in the process of putting together a matching algorithm. The matching process is as follows: Query data is used to perform a "lookup" on a set of reference data in order to determine an applicable id which is then later used in a…
Ian
  • 159
  • 1
5
votes
1 answer

How to implement efficient heterogeneous microservice data queries?

Our team has an idea of implementing a simple declarative DSL that would let users query the enterprise's domain model via a single interface without caring which specific microservices to call to get specific portions of data and how to then relate…
Den
  • 4,827
  • 2
  • 32
  • 48
5
votes
1 answer

How to model and query spatial responsibilites of company local branches

what are best practices, to model and query spatial responsibilities of company local branches? My company has many local branches which are all in general responsible for 1 city. This is the easiest case. However, there are some exceptional cases.…
Turbokiwi
  • 153
  • 3
5
votes
1 answer

Is python lambda "really formal" λ-calculus or just share the name?

Now and then I use the Python lambda. Is it so formal that it is safe to say that you can do formal lambda calculus with it? I just used it but I didn't fully understand whether the python lambda and the lambda calculus like I read was done by…
Niklas Rosencrantz
  • 8,008
  • 17
  • 56
  • 95
4
votes
1 answer

How to query data from multiple microservices

I have micro service architecture application. One of the services contains all user related information. Another service contains a set of business objects. The Angular UI calls rest APIs of user-service and business-service to perform operations…
TechCrunch
  • 613
  • 2
  • 10
  • 17
4
votes
1 answer

End user query syntax?

I'm making a command line tool that allows end users to query a statically-schemed database; however, I want users to be able to specify boolean matchers in their query (effectively things like "get rows where (field1=abcd && field2=efgh) ||…
weberc2
  • 258
  • 1
  • 6
3
votes
4 answers

Strategy to improve performance on key-value pairs table

The situation Our system has a MySQL database with a product table whose parameters can't be modified. In order to add optional extra parameters, a developer designed a key-value pair table which looks a bit like…
xDaizu
  • 247
  • 2
  • 8
3
votes
2 answers

Designing a api with chain of queries

I am trying to write a rest GET api to serve query results. The entire flow happening on the server is: Fetch user data Call the first query, if results generated: return results, else continue Call the second query, if results generated:…
mik dass
  • 141
  • 4
1
2 3 4 5