data-modeling

Data Modeling Question for Rails

I have the following entities. User Event Expense Guest A User is someone that is registered with my site. An event is something that a specific user can create and then invite people to (other users). An expense is created by a specific user for a specific event and can be associated with other users/guests of the event (like us...

MySQL data modeling: Multiple user types / Activity / Following

I have a project in which there is a site with multiple user types. And I am having trouble wrapping my head around the best practice for this. I want to be able to get activity from (nodes) you follow regardless of node type. Pretend the node types are: User: Organization: An organization will be an entity that can act as a user. ...

Where can I find SQL statements to create EAV model?

Alternatively, anyone know of where I can get the EAV model for Erwin? ...

which data model storage strategy ?

I am trying to come out with a good design for the storage of a data model. The language is python, but I guess this is fairly agnostic. At the moment I envision three possible strategies: Object database The datamodel is a network of objects. When I create them, I specify them as descendant from a persistence object. Example: class ...

Is it possible to get any database's elements as a set queriable classes with EF?

Hello, I'm trying to make an application in which both the developer and the end user are allowed retrieve data from a relational DB (chosen at runtime) without writing any SQL code at all (and preferably no string concatenations when interacting with the database). The purpose of the application is to two things: a GUI to an expression...

Sql recursion without recursion

I have four tables create table entities{ integer id; string name; } create table users{ integer id;//fk to entities string email; } create table groups{ integer id;//fk to entities } create table group_members{ integer group_id; //fk to group integer entity_id;//fk to entity } I want to make a query that returns all groups where a...

Problem with DBDesigner

Hi everyone. The DBDesigner can synchronize only with MySQL? I tried with SQL Server but don't works. DBDesigner Ver: 4.0.5.6 Tks. ...

Generate graphical schema representation from CREATE TABLE SQL

Hi all, I have a .sql file containing many CREATE TABLE statements. There's no referential specification (MyISAM stuff) but I would enjoy to create different table boxes, and then compose the table relationships by hand. I am using a mac. Is there a free program to do this ? ...

High-Level Design Patterns or Not Reinventing The Wheel

The Holy Grail of programming is to solve a problem once and make continual reuse of that solution forevermore. And, yet, despite my best efforts I find that I am often reworking familiar problems. So GoF design patterns aside, there have been several times that I've designed calendaring, content management, and person/organization add...

help creating a custom auto increment function in mysql

Hello, I would like to create an auto increment function that allows me to maintain uniqueness in designated columns across multiple tables. I understand that this is not supported under mysql's standard functions, but it appears that this can be done by hand. Could someone point me in the right direction? Thanks ...

Database model and calculated balance, mysql

Another question from an app programmer who's trying the first time to get together a DB model himself. In my app, there are users, accounts and transactions. I initially had all tables in 3NF (or so I believe). Then I decided to add a balance field to users, mainly because my code will go open source and I do not want people to mess up...

How to add "Upgrades" entity to product-order database design?

I'm working on a database design for an e-commerce web application. For this question I am simplifying the design and only showing the parts that are relevant to my question. My things of interest (entities) in this scenario are Products, Upgrades, and Orders. The Products and Orders are related in a typical fashion for this type of da...

How to store user profile edits that must be approved before going live?

Hi, I'm trying to figure out how I should save an edit a user makes to their profile in a way that doesn't go live or affect the existing live data until it's approved by an admin. Have a second table for edited profiles then copy over the data on approval? Keep it all in one table and have a _tmp copy of all the fields that are editabl...

Best way to represent a color in a SQL Database?

If I am using .Net and SQL Server 2008, what is the best way for me to store a color in the database, should I use ToString or convert it to an integer, or something else? Edit: All I want from the colour is to be able to retrieve it and draw something on the screen in the specified colour. I don't need to be able to query against it. ...

Database Design

I am making a webapp right now and I am trying to get my head around the database design. I have a user model(username (which is primary key), password, email, website) I have a entry model(id, title, content, comments, commentCount) A user can only comment on an entry once. What is the best and most efficient way to go about doing thi...

Adding "comments" table with an sql connection and php calling

hey.. i need to place a "comments, faq, contact us" table on my site where users will place their name and the comment they want to say to the admin of the site.. some reports about a game they've played.. the "comments" then it will be saved inside an mysql database ("games") within the given "name" and the "ipaddress" of the user (comi...

What do you consider to be the best balance of columns within an address table?

Almost every time that I build an application, I find myself creating an 'address' table to contain addresses for the system. What columns do you create within your 'address' table (or tables if you normalize addresses over more than one) and what is your reasoning behind it? ...

Motorcycle Database (make/model/prod year)

This is more of a resource question rather than technical one. I am building a website for a client who needs to categorize photos (motorcycles) and I am looking for a database of models/years/production year. If anyone knows where I can find such database please let me know. ...

do i need a separate table for nvarchar(max) descriptions

In one of my very previous company we used to have a separate table that we stored long descriptions on a text type column. I think this was done because of the limitations that come with text type. Im now designing the tables for the existing application that I am working on and this question comes to my mind. I am resonating towards s...

uniqueidentifier vs identity

I noticed asp_membership uses uniqueidentifier, and to me, it seemed like a waste of space, because I could not think of a particular reason to not replace it with identity. However, SQL Server is not letting me change it to int. It says "Conversion from uniqueidentifier to int is not supported on the connected database server". After...