data-modeling

Should these be 3 SQL tables or one?

This is a new question which arose out of this question Due to answers, the nature of the question changed, so I think posting a new one is ok(?). You can see my original DB design below. I have 3 tables, and now I need a query to get all the records for a specific user for running_balances calculations. Transactions are between user...

Check My Database Design / PHP/MySQL

Hello, I'm currently working on improving my database to make room for growth. As it stands, different users have different 'permissions' to areas of the website. Some users have permissions to multiple areas of the website. I'd like some feedback if I'm doing this in the most efficient way: tblUsers: usrID usrFirst ...

Find duplicate content using MySQL and PHP

Hello, I am facing a problem on developing my web app, here is the description: This webapp (still in alpha) is based on user generated content (usually short articles although their length can become quite large, about one quarter of screen), every user submits at least 10 of these articles, so the number should grow pretty fast. By na...

Looking for HW double check on database design.

hey everyone... so i'm working on a database design class for university. I've got the question below and my attempt at the diagram here http://tinypic.com/view.php?pic=httchc&s=3.. would anyone mind taking a look and offering suggestions? thanks for the help!! QUESTION: Question 3 The following situation describes a company that ...

What kind of DB structure should I use for a site has infinite sub-category?

For example, "Dole Banana" is a kind of product, it's listed under the "Bananas" category, when I open the "Fruits" category, I want to see "Dole Banana". + Food |--+ Fruits |------+ Bananas |------+ Apples |--+ Vegetables |------+ Onion |------+ Spinach ...

Is using char as a primary/foreign key a no no?

Consider that there is a bunch of tables which link to "countries" or "currencies" tables. For making data easier to read I'd like make CHAR field with country code (eg US, GB, AU) and currency code (USD, AUD) a primary keys in each of those 2 tables and all other tables will use this CHAR as a foregin key. Database is mysql with innod...

Should I use nvarchar(max) in place of a nvarchar(64) column or as an additional column?

I am building a table for tracking the history of particular objects in my database. Currently I have following columns: HistoryId int IDENTITY(1,1) NOT NULL HistoryDate datetimeoffset(7) NOT NULL HistoryTypeId int NOT NULL HistoryDetails nvarchar(max) NULL For the most part each history item will be self-explanatory through the His...

Tool to draw ER Diagrams

I'm looking for a good tool to help me draw ER (entity-relationship) Diagrams on Windows ...

Help with setting up a Database

My site is going to have many products available, but they'll be categorised into completely different sites (domains). My question is, am I better off lumping all products into one database and using an ID to distinguish between the sites, or should I set up a table and /or DB per site? Here are my thoughts SEPARATE DATABASES Easie...

DB integrity: trigger vs. keys/constraints

I and my friend argued with each other about the design of a database. He argues that to ensure the integrity of a complex database is better to use triggers. I believe that for this purpose is better to use keys (primary, unique), and constraints. I think that the use of triggers is dangerous, because they work "behind the scene" and...

Scalable Database System, Critique requested.

I'm looking to build a scalable database solution for the back end of my website. I've been reading about database design lately, and I seem to have developed an idea on my own that might work. I think this is a novel way of maintaining n databases with synchronized data, but I could be wrong. So I'm asking SO to evaluate the idea and te...

Domain Model Design

How would you create a domain model for this simple example? A recipe can have many ingredients and an ingredient can be used in many recipes. How much of each ingredient used in each recipe is also stored. I have designed the following three database tables to store this data and the relationships. I am now trying to create a domain mo...

Entity Framework Model Multiple Table to Single Entity

I've two tables named Modules and Privileges which are related by a foreign key relationship as shown below: I'd like to model Module and Privilege by adding ModuleName to Privilege. Later I'd be interested in creating a derived class (Menu in the illustration) from Privilege by adding a discriminating condition on ModuleName. Is this...

Database naming, static, incoming and analyzed data

We are running a database system which is basically working as a pipeline flow architecture, i.e. we have lot of incoming data, process this using a variety of in-house knowledge data, and then we produce output data. Right now everything is intermingled, which makes it difficult to know what is autogenerated and what is not etc. We ar...

Diagram to model database entries

Hi all! Do you know a diagram to show the entries of an database? I guess something like the object diagram in UML. I know there is the entity-relationship model but it does not show the existing entries of the database. ...

Help with db schema?

I am creating a simple blog app and so far I have 3 tables, Posts, Comments, and Authors. I will just list the primary key for each table as well as a foreign key. Posts will contain postid as a primary key. Comments will contain commentid as a primary key and postid as a foreign key. Posts has a 0 to many relationship with comments....

How to update multiple information at different locations(table) on change of a record?

This is not SO Meta question. I am using SO only as example. In StackoverFlow each answer, each comment, each question, each vote has a effect which produces a badge at some point of time. I mean after every action a list of queries are tested. E.g. If Mr.A up votes Mr.B Answer. So we have to check is this Mr.B's answer upvoted 100 ti...

How to best represent addresses in a database

Possible Duplicates: Is there common street addresses database design for all addresses of the world? What is the best way to store international addresses in a database? Best practices for consistent and comprehensive address storage in a database I currently have four tables, Customers, Contacts, Facilities and Clients. E...

Positive or negative boolean field names

A table's boolean fields can be named using the positive vs the negative... for example, calling a field: "ACTIVE" , 1=on / 0=off or "INACTIVE" , 0=on / 1=off Question: Is there a proper way to make this type of table design decision, or is it arbitrary? My specific example is a messages table with a bool field (private/public)...

Database design question

I'm currently developing a website for a hotel. And one of the things I'm about to implement is worker->superior relationship. What is the best way to do so in MySQL? Here is what I mean: a chef's superior is a head chef, head chef's superior is shift manager, shift manager's superior is general manager. In the employee table, I could m...