database-design

ID for tags in tag systems

I'm implementing a tag system similar to StackOverflow tag system. I was thinking about when storing the tags and relating to a question, that relationship will be directly with the tag name or it's better create a field tagID to "link" the question with the tag? Looks that linking directly to tag name is easier, but it doesn't look good...

Printing Table's structure/schema

I have like 20 or so tables in the database RentalEase and I want to print them out (physically) so I can look at them easier. I don't care too much about what data is in them, just their structure. How can I do this? It's an SQL Express server and I'm using Microsoft SQL Server Management Studio Express to manage it. I remember back wh...

User Authentication outside a SAAS application

I have an open source SaaS workflow application, so it's best that I don't modify the code. For this application, we sell it as a SaaS, in which each company gets a unique URL and the users just login with their credentials. There are 3 groups of users Administrators Inside users Outside users Now I don't want to touch the open souce...

Best approach for storing forum threads and replies in a database

A forum seems to be an interesting project in terms of schema design. I was wondering, to get a recordset consisting of an opening thread and replies, what is the best way? I could store all threads (the first, opening post) in a table and have a table with replies. I could then use the appropriate join to get all the replies in the rep...

Calculated field vs Complex queries in a database (using JPA)

We have a stock control system which manages the flow of certain items in and out of the business or given location. We have records in the db representing the movement of stock and the inbound and outbound deliveries. If you were to add up all the inbound deliveries and then the outbound deliveries and subtract one from the other, you ...

Probably beginner: making MS Text driver ODBC Datasource & connecting

I've got a program that exports data using a user-made .csv or .txt Microsoft Text Driver ODBC datasource. I create this datasource brand new in the ODBC Data Source Administrator, with a path to a directory shared by both the program and the DS. Then in the program I give it my datasource and it apparently wants the datasource to have a...

Something like inheritance in database design

Suppose you were setting up a database to store crash test data of various vehicles. You want to store data of crash tests for speedboats, cars, and go-karts. You could create three separate tables: SpeedboatTests, CarTests, and GokartTests. But a lot of your columns are going to be the same in each table (for example, the employee id o...

Database Design for one-on-one sports

Let's say that I'm developing an application to track boxing results. Is the best way to track these to have two tables, like so: Boxers ====== id name Matches ======= id match_number boxer_id opponent_id result ... and then have two records for each match, one for the winner, and one for the loser, something like this: id match_num...

Is it a good idea to store serialized objects in a Database instead of multiple xml text files?

Hi, I am currently working on a web application that requires certain requests by users to be persisted. I have three choices: Serialize each request object and store it as an xml text file. Serialize the request object and store this xml text in a DB using CLOB. Store the requests in separate tables in the DB. In my opinion I would...

Have you ever worked with Database no "Relations", no "PKs", and no "FKs", just raw data?

Hi all. Nowadays, I'm working on a database, with no "Relations, PKs and FKs", just raw data. I can say that database is just set of papers. When I asked about this, I had this; "Hide the Business". Also, one of my friends said, this always happens in "Large systems". In large systems, they are tyring to hide thier business through ra...

How should you deal with data for multiple prices for a single product?

Each product in my database can have at least three and sometimes four or five different prices, and which one is displayed is based on several factors. How should I attempt to tackle this scenario? Each product can have the following prices: List Price (MSRP) Cost (what we pay for it) Retail Price - shown on "main" site Government p...

Numbering comments in ASP.NET and MSSQL

I've just thought about best way to store comments in database with appropriate numbers according to the article. The idea is to store comments with composite primary key (commentId, articleId) where commentId is generated according to the given articleId. The system of generating should has same principle as IDENTITY generated columns ...

Recording test data in Hibernate

I have an automated test framework for testing hardware widgets. Right now only pass/fail results of test cases are stored into a relational database using hibernate. I'd like to change this so that various characteristics of the test are stored in the database. (e.g. how many gerbils are running inside the widget, the inputs to various ...

Multiple database transaction

In my PHP application ( constructed using symfony framework and Propel ORM), when I add a record to the MYSQL database, I need to update an external MYSQL database using web service API provided by the external vendor. The question is what is the best practice to maintain the database integrity. Take for example, if the first update is ...

database modeling mac app for ruby on rails development

Hello, I am building web applications using Ruby on Rails and I would like to know what's the best tool for OS X to mock a new application from a functionality perspective and not graphic design. I would like to be able to get an idea of what the application will require in terms of resources before starting to write the code. Thanks, ...

Owner ID type database fields

Suppose you have these tables: RestaurantChains, Restaurants, MenuItems - with the obvious relations between them. Now, you have tables Comments and Ratings, which store the customer comments/ratings about chains, restaurants and menu items. What would be the best way to link these tables? The obvious solutions could be: Use columns O...

Default size for database fields

What the size that you use for common database fields, like firstName, lastName, Email, password, etc? I see these common fields in a lot of databases of blogs, forums, e-commerces, etc. But I don't know if there is some reference or default for the size for that common fields. So, I want to know what the method/reference/basis that you ...

Should I use a number or an email id to identify a user on website?

I have a web app where I register users based on their email id. From a design/ease of use/flexibility point of view, should I assign a unique number to each user or identify user based on emailid? Advantage of assigning unique number: I can change the login itself at a later point without losing the data of the user(flexible). Dis...

Private messages design

Hi, I'm developing a new site, and I have to make private messages for our users. I have already made this on other projects, but the design there just doesn't seem right (I can't have more than two people engaged in a message for instance). So what is the "right" approach to this? I'd like to offer my users the same functionality as Fa...

Best way to create a unique number for each many to many relationship

I have a table of Students and a table of Courses that are connected through an intermediate table to create a many-to-many relationship (ie. a student can enroll in multiple courses and a course can have multiple students). The problem is that the client wants a unique student ID per course. For example: rowid Course Student ID (c...