database-design

Developing for constant change in a corporate environment?

I work for a large company currently going through a merger. We are working on several projects involving and not involving the merger. One problem I'm noticing is that many of the groups of developers are very fragmented, even though they mostly support many different projects within their own realm of the business, and the databases ...

SQL Database design help needed

I am trying to limit the about of tables in my database because I hear that's good (I am a novice web developer). I want to have the user input a list into the database. So they input a title, overall comment, and then start making the list. I can't figure out how to do this without making a new table for each list. Because, say one user...

Database Design for Messaging in Facebook

I'm currently working on creating a messaging system similar to Facebook. More specifically, the private messages on Facebook-- complete with an Inbox, Sent Messages, "Unread" and "Read." Is anyone familiar with a similar database structure to what Facebook currently uses for their messaging system? Thanks! ...

How to decouple an app's agile development from a database using BDUF?

G'day, I was reading the article "Database as a Fortress" by Dan Chak from the excellent book "97 Things Every Software Architect Should Know" (sanitised Amazon link) which suggests that databases should not be designed using an agile approach. There's an SO question on agile approaches and databases "Agile development and database cha...

Should/can one generate a database schema of ones classes?

I have designed some classes using Visual Studio class diagramming. Now I would like to persist this data using ORM and maybe other persistence mechanisms. I am wondering if there is a way to generate the SQL based on the properties in my classes, since they fairly well represent the database structure needed. This would save me a lot of...

Implementing User Defined Fields

I am creating a laboratory database which analyzes a variety of samples from a variety of locations. Some locations want their own reference number (or other attributes) kept with the sample. How should I represent the columns which only apply to a subset of my samples? Option 1: Create a separate table for each unique set of attribut...

How to design this database?

I have to design a database to store log data but I don't have experience before. My table contains about 19 columns (about 500 bytes each row) and daily grows up to 30.000 new rows. My app must be able to query effectively again this table. I'm using SQL Server 2005. How can I design this database? EDIT: data I want to store contain...

To Fully Enforce Your Data Model or To Not Fully Enforce Your Data Model

http://weblogs.sqlteam.com/jeffs/archive/2008/08/13.aspx: Consider the following logical data model: * There are multiple Companies * Each Company has many Projects * Each Project has many Tasks * Each Task has a Status, selected from a global list of pre-defined Statuses. Let us say that we decide that the pr...

Join-Free Table structure for Tags

I'm working on a little blog software, and I'd like to have tags attached to a post. Each Post can have between 0 and infinite Tags, and I wonder if it's possible to do that without having to join tables? As the number of tags is not limited, I can not just create n fields (Tag1 to TagN), so another approach (which is apparently the one...

Storing an array in a string (Database experts question)

I have a product table with 100000 products and also I have a user table with 5000 records. and suppose a user can give us feedback about any combination of this products. So suppose he chooses to compare products 1,3,100,200,400,500 and so on. (he can send us another feedback about some other products) So here is my question, I just wa...

Data Model tools for DB2

I have created a Database in DB2 and tables with relationships. I would like to create a ER diagram based on my database design in DB2. MS SQL has a facility to create ER diagrams from DB schema, but DB2 doesn't seem to have one, at least to my knowledge. Any one know of any open source tools/facility within DB2 itself for this? ...

How should I store product and product image data for an online store?

I'm working on a storefront application in PHP with MySQL. I'm currently storing my data in 4 tables: one for product lines, one for specific products within those product lines, one for product images, and one which specifies which images are linked to which specific products. Each specific product belongs to one product line, each prod...

OO and SQL

In trying to understand the correlation between program objects and data in tables (here:http://stackoverflow.com/questions/1149877/oo-program-and-sql-database), which I still don't really understand, a strong difference of opinion was revealed over whether it's ok to use a SQL db to store data for an OO program. For a new programmer...

Best practices for writing data access in ASP.NET

Ideally I would like to put all the code to access and fetch the data from the database in a separate utility files and all those methods at data binding times from the .net code behind file. The problem comes is when should the connection object be closed. For simple stuff, the helper method can close the connection but for things like ...

What is the best way to store the order between rows in the database?

I am cloning and extending the Google Tasks application. I want to be able to store the rows order. I have created a field in the database, named rowNumber. When the user inserts a row in the middle of others, I have to update this field in many other rows to achieve the desired output. There is a better way to do it? BTW the applicatio...

Postgresql: is better using multiple databases with 1 schema each, or 1 database with multiple schemas?

After this comment to a my question, im thinking if is better using 1 database with X schemas or viceversa. My situation: im developing a web-app where, when people do register, i create (actually) a database (no, its not a social network: everyone must have access to his own data and never see the data of the other user). Thats the wa...

Anyone have an ERD symbols quick reference?

I'm looking for a one-page quick-reference or cheatsheet (preferably in PDF) to the meanings of the various ERD symbols in Crowsfoot/Martin notation. I've done a lot of googling, but have not found a good, concise quick-reference guide, though I'm sure one must exist. ...

Database Design/Modeling Question - Constraints or No Constraints?

Given the following structure: City Area User Every Area has 1 and only 1 City. Every User has at least one but possibly multiple Areas. Every User has 1 and only 1 City. What is the most elegant way to model this? Currently, I have: User, UserArea, Area, City Where UserArea is a 1:M relationship w/ User, and Area is 1:1 with Cit...

understanding mysql explain

So, I've never understood the explain of MySQL. I understand the gross concepts that you should have at least one entry in the possible_keys column for it to use an index, and that simple queries are better. But what is the difference between ref and eq_ref? What is the best way to be optimizing queries. For example, this is my latest ...

MySQL runtime-generated view

On redesigning a MySQL database I came up with an idea: creating a VIEW which can be altered when a TRIGGER (on UPDATE of other table) runs, using information selected from the INFORMATION_SCHEMA database. Hence we could have a view of whichever columns might be necessary at runtime. Since ALTER TABLE is illegal inside triggers, the set...