data-modeling

Modeling Friends and Followers in an RDBMS

本秂侑毒 提交于 2019-12-03 00:47:14
I'm trying to decide on the best way to model a relationship of records in a relational database. It's the classic friend/follow model: ~~~~ A User can have zero to many friends. A User can have zero to many followers. Friends and followers are both Users themselves. ~~~~~ What's the best way to model this? Thanks! Users (UserId, ...) Subscription (Subscriber, Publisher) Friendship (FirstUser, SecondUser) CREATE TABLE Users ( UserID int not null primary key, ... ) CREATE TABLE Subscription ( Subscriber int not null references Users(UserID), Publisher int not null references Users(UserID),

How to keep ordering of records in a database table

不问归期 提交于 2019-12-02 21:06:20
i am creating a database table that is going to store menu links that will ultimately show up on a web page. My issue is that i want to control the order of the menu items. I could have a field called order but everytime i have a new menu link i would have to insert the order and change all of the records with higher order to +1. For example, lets say i want the links ( in this order): Home About Products Shopping i could have a table called MenuLinks and have the columns: Name, Order my data would look like this: Name Order Home 1 About 2 Products 3 Shopping 4 but if i wanted to now add a new

Determine Event Recurrence Pattern for a set of dates

删除回忆录丶 提交于 2019-12-02 19:21:42
I am looking for a pattern, algorithm, or library that will take a set of dates and return a description of the recurrence if one exits, i.e. the set [11-01-2010, 11-08-2010, 11-15-2010, 11-22-2010, 11-29-2010] would yield something like "Every Monday in November". Has anyone seen anything like this before or have any suggestions on the best way to implement it? Grammatical Evolution (GE) is suitable for this kind of problem, because you are searching for an answer that adheres to a certain language. Grammatical Evolution is also used for program generation, composing music, designing,

Relational vs Non-Relational Data Modeling - what's the difference

天涯浪子 提交于 2019-12-02 19:07:34
I'm new to databases and I've never worked with any RDBMS. However I get the basic idea of relational databases. At least I think I do ;-) Let's say I have a user database with the following properties for each user: user id name zip city In a relational database I would for example model it in a table called user user id name location_id and have a second table called location location id zip city And location_id is a foreign key (reference) to an entry in the location table. If I understand it right the advantage is here, if the zip code for a certain city changes I only have to change

Xcode consistency error: Setting the No Action Delete Rule… is an advanced setting

梦想的初衷 提交于 2019-12-02 17:37:41
After creating a data model in Xcode, it's throwing the following error for each of the object relationships: Consistency Error: Setting the No Action Delete Rule on [object relationship] is an advanced setting What is Xcode trying to tell me, and how should I respond? Core Data uses inverse relationships and delete rules to keep the object graph consistent Let's say you have A.foo <1—1> B.bar and do a.foo = b . This automatically (effectively) performs b.bar = a . Now let's say you [b delete] . With the "nullify" rule, effectively does b.bar.foo = nil . With "cascade", it does [b.bar delete]

A good database modeling tool for PostgreSQL? [closed]

折月煮酒 提交于 2019-12-02 17:28:34
PostgreSQL comes with the excellent pgAdmin-tool for managing the database but lacks GUI data-modeling utility? I found this list: http://www.databaseanswers.org/modelling_tools.htm but don't have time to evaluate them. Which one do YOU recommend? pgModeler looks promising: http://pgmodeler.com.br You might also want to have a look at Power*Architect. http://www.sqlpower.ca/page/architect WWW SQL Designer is a great lightweight modeling tool, and it supports PostgreSQL. SQuirreL also seems nice, I haven't tried it though. The MySQL workbench is a fine modeling tool that's free, but you'll have

How to design the relations between USER and FAVORITE(or LIKE) models in DB

喜你入骨 提交于 2019-12-02 16:38:11
问题 I have these models(tables): USER , PHOTO , BOOK , QUESTION etc. And now I wanna add the favorite or like feature to the site, that is user can 'like' some photos or books or questions, and of course a photo can be liked by many users. So I wanna ask you how to implement this kind of thing. a page to show the books, photos, quesitons etc which are liked by the current login user; how many people like the book. Here is my thoughts, give it simple. A table: books_users book_id user_id table:

How to design the relations between USER and FAVORITE(or LIKE) models in DB

心不动则不痛 提交于 2019-12-02 07:36:23
I have these models(tables): USER , PHOTO , BOOK , QUESTION etc. And now I wanna add the favorite or like feature to the site, that is user can 'like' some photos or books or questions, and of course a photo can be liked by many users. So I wanna ask you how to implement this kind of thing. a page to show the books, photos, quesitons etc which are liked by the current login user; how many people like the book. Here is my thoughts, give it simple. A table: books_users book_id user_id table: photos_users photo_id user_id table: questions_users question_id user_id B table: users_likes object_id

Database design for general web form

荒凉一梦 提交于 2019-12-02 05:47:12
I want to build a back end of a general web form which contains questions which the user can answer. There are multiple types of questions. "Normal" text question: the question is answered via a simple text field. Example : General personal info, like the name. Textarea question: the same, but with more space to write the answer. Example : A "More information that you want to add" box. Multiple choice question: a question with some predefined answers, from which a single one can be chosen. Example : How well can you program PHP? [ ] not very well [ ] average [ ] I've wrote the book. ...

Relating an entity to a relationship proper in Neo4j?

独自空忆成欢 提交于 2019-12-02 04:41:21
问题 I'm attempting to use Neo4j to model the relationship between projects, staff, and project roles. Each project has a role called "project manager" and a role called "director". What I'm trying to accomplish in the data model is the ability to say "for project A, the director is staff X." For my purposes, it's important that "project", "staff", and "role" are all entities (as opposed to properties). Is this possible in Neo4j? In simpler terms, are associative entities possible in Neo4j? In