Questions tagged [relational]

526 questions
4
votes
10 answers

What's the best way to get related data from their ID's in a single query?

I have a table where each row has a few fields that have ID's that relate to some other data from some other tables. Let's say it's called people, and each person has the ID of a city, state and country. So there will be three more tables, cities,…
Murat Ayfer
  • 3,894
  • 6
  • 29
  • 26
4
votes
2 answers

Use Event Sourcing to get rid of relational database?

I've read some articles about CQRS and Event Sourcing recently. While the first seemed to me like a highly complex and risky workaround to fix poorly performing business and poorly designed data access layers and data models, the last seemed like a…
Erik Hart
  • 1,114
  • 1
  • 13
  • 28
4
votes
2 answers

Swift and Parse.com : relational query

On parse.com, I have a table named "ExerciseInstance" with a "pointer" to the "_User" table (with the user's objectId). In my Swift code, I want to get all the rows from ExerciseInstance with UserAccount<_User> = "MZmMHtobwQ" This does not…
4
votes
3 answers

Modeling relational data from REST api via angularjs

I'm building an app, that is backed with node-mysql combo, and angularjs on the frontend part. The backend REST service is ready, but I'm struggling with modeling my relational data. There are some questions regarding this like : $resource relations…
mike_hornbeck
  • 1,612
  • 3
  • 30
  • 51
4
votes
2 answers

Terribly slow SQL query with COUNT and GROUP BY on two columns

I'm archiving this web forum, which normally gets purged about once a week. So I'm screen scraping it, and storing it into my database (PostgreSQL). I also do a little analysis on the data, with some graphs for users to enjoy, like what time of day…
Luka
  • 63
  • 1
  • 5
4
votes
1 answer

On Postgres databases, does relationship constraints degrade performance?

This is my first post here and I've tried to do my homework. I need to have a better way to develop Data Warehouse databases for Postgres than using Power*Architect. Here is the complete sad history: I work with Data Warehouse development, mostly…
4
votes
5 answers

mysql - query three tables

I have a relational database with three tables. The first containts id's that relate to the second. The second contains id's that relate to the third. The third contains the results I am after. Is it possible with a single query to query an id in…
Mark
  • 5,423
  • 11
  • 47
  • 62
4
votes
3 answers

Logical operators - short (relational) vs long (vector) forms

I am getting a bit confused by the use of the short and long forms of logical operators in R. If I have the following values A <- FALSE B <- TRUE X <- 3 Y <- 2 I would like to evaluate NOT(A) OR NOT(B) AND X < Y I expect FALSE given the…
Simon O'Hanlon
  • 58,647
  • 14
  • 142
  • 184
4
votes
2 answers

Choosing a database type

When would you use a bigtabe/simpledb database vs a Relational database?
Aaron Fischer
  • 20,853
  • 18
  • 75
  • 116
4
votes
5 answers

Employee Department Relationship in Database

I'm designing a relational database for SCM (as part of designing information system for the enterprise). But when it came to the relationship between the employee and its department, I had some troubles . I designed the following entities :…
Wadda7
  • 69
  • 1
  • 2
  • 4
4
votes
2 answers

Retrieve maximal / minimal record

A rather complicated SQL query I was working on got me thinking about a limitation of (ANSI) SQL: Is there a way to retrieve a record that is maximal or minimal with respect to an arbitrary ordering? In other words: Given a query like this: SELECT *…
sleske
  • 81,358
  • 34
  • 189
  • 227
3
votes
1 answer

Advantages of keeping to a protocol for a data model

The question title is probably not correct because part of my question is to try and get some more understanding on the problem. I am looking for the advantages of making sure data that is imported to a database (simple example: Excel table to…
Pricey
  • 5,799
  • 12
  • 60
  • 84
3
votes
4 answers

Dynamic Types within a Relational Model using Object-Role-Modeling (ORM)

In Object Role Modeling (ORM), given an entity of thing that had a relationship to an entity of type and where the type entity can be specified to live and the thing entity could have a value for date of birth, how would I specify a constraint that…
Blake Taylor
  • 9,217
  • 5
  • 38
  • 41
3
votes
2 answers

DATEADD - How do i make comparisons

I am trying to check if the second attempt(u can imagine anything like password attempt, download attempt etc) is made within a time limit(@window) starting from attempt1 time(@start). Why does this report a Syntax error when other datetime…
Deeptechtons
  • 10,945
  • 27
  • 96
  • 178
3
votes
2 answers

In SQL, how do you get the top N rows ordered by a certain column?

I want to select the top N rows of a table, ranked by how high the number in one of their columns is. I already have: SELECT * FROM movie ORDER BY worldwide_gross DESC; How can I get the first twenty? If it makes any difference I'm using…
Alistair
  • 8,066
  • 14
  • 39
  • 43