FAQ Database Discussion Community


many-to-many relationships with fields in a RESTful API

rest,entity-relationship
I post the same unanswered question from a comment. Let's say I have 2 entities (Team and Player) and a many-to-many relationship (Registration) which have id_team and id_player fields but also others information like registrationDate. GET /teams/{id}/players give me all players of a specific team GET /players/{id}/teams give me all...

MYSQL Balance Sheet Design

mysql,foreign-keys,primary-key,entity-relationship,foreign-key-relationship
I'm working on creating an ERD Diagram to map out a MYSQL database. One of my entities in the ERD Diagram is Balance Sheet. How I have it setup right now is: Company PK Company ID Company Name Balance Sheet PK Balance Sheet ID FK Company ID Year Month I...

rails 4 HABTM relation and extra fields on join table

ruby-on-rails,join,entity-relationship,has-and-belongs-to-many
What I have (pseudo code): model Document column :title HABTM :users model User column :name HABTM :documents Document has users (being approvers for document, either approve or not), and in this context join table should have extra column approved for each user. jointable user_id, document_id, approved 1 , 1 ,...

MySQL - Cannot create ERD in Server Instance Schemas

mysql,mysql-workbench,entity-relationship,erd
I am brand new to MySQL and I am trying to understand how it all fits together. I have a very strong understanding of Microsoft Access, but this is a whole new world. I create a schema (MySQL Model) and I had no problem creating an ERD. I then figured...

how to let user create his own database asp.net website

c#,asp.net,database,entity-relationship
We're building an app where like accountant application online each user is required to have a personal database and I'm trying to find the best way to implement this or I don't know should I put all company data in one database. So far the options are •every company registered...

one account have many friend who have same attribute of user ? how to implement it in DB & how it look like in ER diagram

mysql,database-design,many-to-many,entity-relationship,self-reference
one account have many friend who have same attribute of user ? how to implement it in DB & how it look like in ER diagram i'm trying to build simple DB project where i have user with (email,password) each user have many friend where the friend also a user...

Use related entity multiple times in query

.net,vb.net,entity-framework,linq-to-entities,entity-relationship
I'm trying to get a list of two tables into one list of a generic class I made. My question is how I could get the fields from the related table without calling firstOrDefault for each field, please see sample code, I need a verly long line for fields Price...

How to set up Primary Keys in a Relation?

database,database-design,relational-database,database-schema,entity-relationship
I wish to know how to correctly set up Primary Keys in a Relation. E.g. we have ER-diagram which contain elements: Key attributes Weak key attributes Identifying relationships Associative entities In order to translate it into Relational Model we should do some tricks. All elements above deal with Primary Keys...

How to detect if entity exist in database

symfony2,doctrine,entity-relationship
I have 2 entities, User and Profile. Profile has in-symfony relation with User, but there is no in-database relation (no foreign key, no cascade) - only simple int column named user_id and nothing more. Problem is obvious: when i delete user - associated profiles persists, but their user_id points to...

How can i split an ArrayList of Shapes into partitions/lists in Java (Just advice)

java,arrays,arraylist,entity-relationship,shape
I just want an advice or suggestions of how i can do it. i've been thinking about it for hours now and can't find a solution. My aim is to convert this ER Diagram to tables. So i have a Rectangle(Entity) that is linked to an ellipse(Attribute). I've already worked...

Is relevant the order of INSERTion in MySQL?

mysql,database,entity-relationship
I have multiple tables, related by multiple foreign keys as in the following example: Chefs(id_chef,name,stars) - where id_chef is the primary key. Recipes(id_recipe,name,calories,category) - id_recipe as PK. Ingredients(id_ing,name,type) - id_ing as PK. Contains(id_chef,id_recipe,quantity,unit) - (id_chef,id_recipe) as PK, and as Foreign Keys for Recipes(id_recipe) and Chefs(id_chef). Autorship(id_chef,id_recipe) - Same as previous....

Listing specific requirements on Access Database form

database,ms-access,access-vba,relational-database,entity-relationship
I am trying to create a database using Microsoft Access Database, but I have a problem. I want to create a database that holds information for computer components and a form to list certain components to build a computer. For example, I want to build computer A, and I have...

One to One ER with a Type or Status table instead of a Type or Status column

database,database-design,relational-database,entity-relationship
I have a long way to go with ER modelling, as you'll soon see, but I have a project I'm doing for a construction firm and I'm getting my hands wet with the database model. The company is a roof inspections company and they have projects on sites and proposals...

Entities with a strict 1-2 relationship

database-design,entity-relationship,er-diagram
I am trying to understand how do we model and define the cardinality of two entities when the relationship is of exact nature. Lets say 1 to 2. For an example, if I have entities Journey and Location. Now each journey has 2 locations, a starting location and an ending...

The three schema of the database

database,database-design,relational-database,database-schema,entity-relationship
I have created a database in Access and right know i have to write a report. I know that the databasesystem has three forms of schemas: physical, conceptual and external. Does the following ER diagram (by using the method normalization) belongs to the conceptual level?: Or does this belong to...

Yii: relate n:m on both sides of an AR

php,mysql,yii,entity-relationship
For a better user experience, I didn't want to just make a casual PM system, but actually group it into conversations. And as an added feature, being able to PM multiple people at once. Something that was requested multiple times. So I created this: /* User conversations ONE Conversation HAS...

Translating ER diagram to Relational model

database,relational-database,entity-relationship,erd
I have a question about the ER diagram below. Question: If there are 2 relationships born and live from actor to place entity. Do they both have the same foreign key which is place_no? So does that mean I just put the foreign key in Actors relational model and that's...

Symfony2: Error “Property was already declared, but it must be declared only once”

symfony2,doctrine,entity-relationship
As I am new to Symfony, I tried creating the entity relationship using Doctrine. I am getting the error Property "report" in "[bundle/entity/file_location" was already declared, but it must be declared only once" when I try to update the schema. I have followed the Symfony documentation, but could not find...