relationship

SQL : one foreign key references primary key in one of several tables

I am working on an application that will be used as an extensible framework for other applications. One of the fundamental classes is called Node, and Nodes have Content. The SQL tables look like this: TABLE Node ( NodeId int, .... etc ) TABLE NodeContentRelationship ( NodeId int, ContentType string, ContentId int) It will be up to t...

Representing parent-child relationships in SharePoint lists

I need to create some functionality in our SharePoint app that populates a list or lists with some simple hierarchical data. Each parent record will represent a "submission" and each child record will be a "submission item." There's a 1-to-n relationship between submissions and submission items. Is this practical to do in SharePoint? ...

Preferred way to map code with user created database entries

I am trying to work out the best database model for the current setup: An administrator can create "customer products". This means services/products which customer can attach/subscribe to. The simple cases where the product simply costs a price, or the product subscription should send an e-mail is easy to model in the database. But how...

What is the difference between holding object of a class and agregating them?

May be the questions sounds newbie, but I can not distinguish the difference between agregating and holding. What does it mean in terms of, let`s say, C++? I suppose when the object of class A holds (or instantiates) objects of class B, it uses it to perform some functions by itself. For example: class A { int state; public: A(int s...

How to design a movie database?

Hi Guys, I'm trying to get my head round this mind boggling stuff they call Database Design without much success, so I'll try to illustrate my problem with an example. I am using MySQL and here is my question: Say I want to create a database to hold my DVD collection. I have the following information that I want to include: Film Tit...

How do you model a simple composition relationship

Can someone help me understand how best to model a composition relationship? If for instance I have a student whom can have many schedules, I would create roughly: class Student { prop long Pk { get; set; } prop string Name { get; set; } prop List<Schedule> Schedules { get; set; } } class Schedule { prop string Semester { get;...

Deletes in one-to-one relationships? Normal behavior?

When working in Access, whenever I delete a record from one table - it's corresponding record in another table is also deleted when defined as a one-to-one relationship. This would be normal behavior when I tell it to enforce referential integrity with concerns to deletes and updates (how I understand it). However, it seems to also do ...

managing relationships between agregated / composited members of a class

I am creating entities for a simulation using aggregation and composition. In the following C++ example: class CCar { CCar( CDriver* pDriver ) { m_pDriver = pDriver; } CDriver* m_pDriver; CEngine m_Engine; CDriverControls m_Controls; }; in the above example, a car consists of an engine and a set of driving con...

removing a circular DB relationship

Hi, How can I get rid of a circular relationship in my db structure. I have an entity called Item. An item can have a sub item/s (circular relationship). An item can have more than one rate depending on what financial year it is(rate_per_year entity created for that purpose and a 1-m relationship). If an item has a sub item, then it ma...

Cosine similarity vs Hamming distance

Hello! To compute the similarity between two documents, I create a feature vector containing the term frequencies. But then, for the next step, I can't decide between "Cosine similarity" and "Hamming distance". My question: Do you have experience with these algorithms? Which one gives you better results? In addition to that: Could you...

Django Relational database lookups

I cant figure out how to do relationships. I have a products model and a stores model. A product has a foreign key to the stores. So i would like to get the product name, and the store name in the same lookup. Since the products model is: class Products(models.Model): PrName = models.CharField(max_length=255) PrCompany = models....

Dictionary table relationships (MS SQL 2005)

I have table named 'Dictionary' with columns as follow: ID bigint TYPE varchar (200) ITEM varchar (200) Table is used by various tables as simple dictionary / lookup. Eg it stores countries, titles, business type lists. TYPE column keeps info about type of dictionary , ITEM is dictionary string value. All works well but I ha...

Calculate Family Relationship from Genealogical Data

I would like to be able to calculate the family relationship between two individuals in a family tree, given the following data schema (simplified from my actual data schema, only showing columns that directly apply to this problem): individual ---------- id gender child ---------- child_id father_id mother_id With this structure, ho...

How do I retrieve specific attributes of a relationship/collection?

Hi All, Is there a good way to retrieve all of a specific attribute from a relationship/collection? For instance, I want a list of all the names of a person's cars. Obviously I can't do the following: Person.Cars.Name(s) ...but does something of that nature exist in ruby (or is there an ActiveRecord helper method) that handles that?...

Best DBMS for iphone

What is the best DBMS to use in iphone when there is huge data that is to be sorted and searched often. I though to use sqlite but it has many complexities. as when a table is created once it doesn't allow to change its structure, No way to define relationship etc. Can any one guide me wat way to follow Regards, ...

Office Open XML: Relationship not used in the document

I have an Open Office XML document where a relationship that is defined in a relationship part is not used anywhere in the document, neither in the MainDocumentPart nor in any other part. Is this an invalid OpenXML Documment or not. Are unsues relationships allowed do the cause the document to be invalid? ...

How to layout a subscriptions database (like youtube)?

Hello! Like youtube, i have a usertable, a table with objects (videos) and a table with categories. Now, I want a user to be able to subscribe to a category, but how do I do this effectivly? I would need a table for keeping track of which categories a user subscibes to (many-to-many relationship), but I also need to keep track of which...

Changing a relationship / foreign key in Entity Framework - not being persisted

Hey there, Ive got a WPF app, following the Model View ViewModel pattern, using the Entity Framework to interact with a SQL 2008 database. Problem: My problem is i can't change a foreign key value in the databse using EF. I have two entities: Site and Key. A Site can have many Keys on it. I would like to move a Key from one Site to a...

how to fetch Has_many relationship values on RAILS

Can any one please help to how to fetch the values of attributes from the has_many Relationship on rails For example company is one relation and has many email company --> email i need to fetch email_address from those company.email How can i do that? company.email.email_address ...

many-to-many relationship in database design

I currently have a database with two tables called Articles and Tags . In order to allow articles to be in multiple categories i have a many to many relationship. Is it a mistake to have such a design in terms of performance? or should i remove the relationship between these two table and add a third table as a bridge (articlesTags)? ...