Questions tagged [relational]

526 questions
2
votes
1 answer

Accessing parent query variables in sub query

I have a mysql query that look likes this select s.id, sum(history.virality) from spreads s , ( select ( ( (sum(t.likes)) + ( sum(t.comments)) ) * ( 1 / ( 1 + s.created_at / 3600000 ) ) )as response …
2
votes
1 answer

good way to store tags in relational database when there are variable numbers of tags associated with each piece of information

I want to store sentences that can be tagged with variable numbers of tags in an SQL relational database. So, I may have a sentence such as 'As the sun sets slowly in the west, we bid you a fine farewell.' tagged with the following…
d3pd
  • 7,935
  • 24
  • 76
  • 127
2
votes
3 answers

mySQL - Insert into three tables

I recently asked this question. 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…
Mark
  • 5,423
  • 11
  • 47
  • 62
2
votes
5 answers

Best Practice for relationships shared among multiple tables

I keep running into this design problem, and I'm not happy with my solution so far. The problem is this: I have two or more entities, like People and Dogs, and they both have a relationship with a Notes table, that stores a message field and some…
Pete Michaud
  • 1,813
  • 4
  • 22
  • 36
2
votes
4 answers

Learning NOSQL databases using a single machine?

In relational databases I would just pop in W3Schools tutorial, install mysql in my machine and start practicing! How can I learn non relational databases in a similar way? In most tutorials I read that these databases work with multiple nodes and…
vasilakisfil
  • 2,279
  • 4
  • 24
  • 31
2
votes
1 answer

How do I query three tables based on a single field

I have three tables in an SQL database. This relational system was designed by someone else but I was asked to create a new query because he no longer works for the company. I will use sample names for confidentiality…
2
votes
2 answers

Doctrine - database relation - many-to-many add status

How do I implement the following scenario the best way in ORM (Doctrine)? Scenario: A user can belong to one or many teams. A team can consist of one or many users. So, the first part is no problem, but I want the user to have an…
2
votes
3 answers

How do I improve query to select records with MAX date that uses joined tables in PostgreSQL?

I have three large tables as follows... property -------- property_id other_prop_data transfer_property ----------------- property_id transfer_id transfer -------- transfer_id contract_date transfer_price I want to return a list of unique…
2
votes
1 answer

Lucene: query or filter for relational search for "owned" documents?

I have a data set whereby documents can optionally be associated to a user id. Say that the documents represent books, and each book can have one or more owner. When searching, I want to match on books that I own first before matching on books I…
Uncle Long Hair
  • 2,719
  • 3
  • 23
  • 33
2
votes
2 answers

Intelligent ways to maintain versioned copies of tables in a relational database (programming considerations?)

My second consideration was to simply make a copy of the table data associated with the active document or folder of documents that the baseline was applied to, and store that for safe keeping. The code complexity savings would be enormous, the…
Bob
  • 2,002
  • 3
  • 16
  • 18
2
votes
1 answer

How to translate a table into a rdf graph?

Let's consider a table in a relational DB, with two attributes x and y, and two rows: 1) x=January, y=12 2) x=February, y=3 If I wanted to translate this in a rdf graph, I would define: an URI/bnode for the table ":table1"; a bnode for each…
Emanuele
  • 21
  • 2
2
votes
4 answers

Complex IF statement with 3 tables

This is a continuation of this question from yesterday. Here are my three tables: Fighters Table fighter_id | name ----------------------- 1 | John 2 | Steve 3 | Bill 4 | Bobby Events Table event_id | …
zen
  • 1,115
  • 3
  • 28
  • 54
1
vote
2 answers

SQL static data / lookup lists IDENTIFIER

In regard to static data table design. Having static data in tables like shown: Currencies (Code, Name). Row example: USD, United States Dollar Countries (Code, Name). Row example: DE, Germany XXXObjectType (Code, Name, ... additional…
van
  • 74,297
  • 13
  • 168
  • 171
1
vote
3 answers

Effecient way to model aggregate data of a many-to-one relationship (e.g. votes count on a stackoverflow question)

I'm curious about what be the best way to model this for optimized performance... not as concerned about real time data integrity I'll continue with the stackoverflow example Question id title Votes id user question A question has many…
nategood
  • 11,807
  • 4
  • 36
  • 44
1
vote
5 answers

SQLite, MySQL or Both for Android Application

I'm in the process of designing an Android application right now. I understand SQLite works on the phone device within the file structure. However I'm not sure if it's practical for our use. If I'm wanting to store data that's available to all…