database-design

Simple Database Design Question

Hi, I am developing web application that powered php and mysql. I have table named users, in this table i store some information such as username, first and lastname, telephone number etc.. In my application user can enter some OPTIONAL information such as e-mail newsletter options, company name(if works..) or web site url. All of these ...

Database design for storing an unknown number of rows in table

Hi. Sorry if the title is hard to understand.. :S I have a table with an order, and this order should be able to have an unknown number of pizzas. How do I implement this? I have a table for pizzas, and a row for PizzaID. The order table should have an unkown number of pizzaIDs.. :S Thanks ...

How to show related posts in my website

What is the best design to implement a related post feature. I have a web site where users will post questions.The table has POST_ID,POST_TITLE,CATEGORY,DATE_CREATED,POSTED_USER_ID. Now i want to show the related /similar questions in the page when i show each question.How to do this ? What should be the ideal table structure for this, H...

Database design for tags and URL

I'm building simple application for myself in JSP which stores URL for me and finds it based on tags. For which i want to design a database. I'm limited with my knowledge of SQL. But still i want to learn by doing. I want to create database that stores tags for the URL and the URL itself. The URL could be text(50) or more in a table co...

User Stats: "interative calculation" or bulk calculation + caching

I have a project that calculates a number of 'statistics' about a users performance and then shows it to them. All these statistics ultimately come from a large table of 'interactions' that record the users interaction with the site. At the moment, all these statistics are calculated by looking at this data. We make extensive use of p...

In what scenarios is it better to use tables for user sessions rather than native sessions?

That's about all that I need to ask I am dealing with a site right now and I can't see a really significant difference in storing my sessions in a database table over and not doing so. ...

Hidden problems when modelling data using business objects

A common approach to data modelling is to use a data modelling tool (e.g. Erwin) to generate a schema, and then from the schema to generate business objects using an object relational mapper (ORM). Less common is the reverse process where the data modelling is done using business objects (e.g. POCO/POJO's), from which the schema is gene...

Database 2NF question

If I add an id column to a table, and set id as the primary key, will the table be in 2NF? ...

One log table vs log columns on every table

I log insert and update info to every table create_date TIMESTAMP create_user_id INT update_date TIMESTAMP update_user_id INT I thought that instead of putting them on every table, creating only one log table and referencing the log table on every table so I can retrieve the log info only when I need. I know it depend on the ap...

Comparing Database Platforms

My employer has a database committee and we've been discussing different platforms. Thus far we've had people present on SqlLite, MySQL, and PostreSql. We currently use the Microsoft stack so we're all quite familiar with Microsoft Sql Server. As a part of this comparison I thought it would be interesting to create a small reference app...

how to model this database relationship? (sybase powerdesigner)

I'm doing a conceptual model in Sybase PowerDesigner. The restriction is following: One doctor can work in only one office at a time during his working time (shift). I guess Doctor - Office relationship should be many-many, but what about time restriction ("during his working time")? Should it be a new table SHIFT? So I guess I shoul...

How can I handle multiple row revisions in a single table?

I'm working on an app where users enter pricing quotes. They want to be able to have multiple revisions of the quotes and have access to all of them to revise and view. Currently the data is stored in a Quotes table that looks like this: QuoteID (PK, autonumber) data1, data2, data3 and so on. QuoteID foreign keys to other tables for o...

Should every field in an Oracle database have a check constraint if possible?

If I know the correct format of fields, should I create check constraints for all of those fields, or will this affect the performance of inserts/updates too much? Would it be a good idea to use regular expressions for complex rules, or should I only use simple constraints like case and length? The fields are already being validated at ...

If a Column is a Foreign Key does it need an Index?

I have created indexes on many of my columns in my tables. Many of these columns are foreign keys as well. Can I safely delete the indexes on the columns that are foreign keys? ...

what is qdb? database

At my work place they use qdb to store data. Can someone tell me in more detail "why qdb?" and can you refer me to some link so that I can read more about it? because everytime i search for qdb i find GDB pages ...

What are some methods for persisting customer configurable data in a database?

I'm looking for some ideas on methods for persisting customer configurable data in a relational database (SQL Server 2000 in my case). For example let's say you have a standard order entry application where your customer enters a product they want to buy. In addition to the fields that are important to both you and the customer (item...

How to use the SQLite.NET designer Visual Studio add-in

I've installed SQLite.NET and during the installation I checked the boxes about design-time support, which should be a Visual Studio add-in I can use to model databases. However, I can't seem to find out how to open/start this designer. Could anyone post a simple instruction please. Thanks. ...

What is the benefit of having varbinary field in a separate 1-1 table?

I need to store binary files in a varbinary(max) column on SQL Server 2005 like this: FileInfo FileInfoId int, PK, identity FileText varchar(max) (can be null) FileCreatedDate datetime etc. FileContent FileInfoId int, PK, FK FileContent varbinary(max) FileInfo has a one to one relationship with FileContent. The FileText is meant...

When two tables are very similar, when should they be combined?

I have events and photos, and then comments for both. Right now, I have two comments tables, one for comments related to the events, and another for photo comments. Schema is similar to this: CREATE TABLE EventComments ( CommentId int, EventId int, Comment NVarChar(250), DateSubmitted datetime ) CREATE TABLE PhotoComments ( C...

SQL Server - Database Design - Best Practices

We are developing an ASP.NET application and carrying out the database design too. Kindly let me know if you know any best reference document for SQL Server database design - best practices. ...