database-design

Automate SQL Server DB Schema Diagram Generation

As part of our DB change control process one of the tasks is to reverse engineer the changes into our schema diagram, using Visio. This is a little tedious and we were looking at a way to automate this. We already have a CI and Release to test process that generates the latest DB all we need is some application that will analyse the da...

Step-by-step instructions for updating an (SQL Server) database?

Just a question about best-practices when upgrading an existing database. Assuming there will be all kinds of modifications to the data itself, the structure, the relations, additional columns, disappearing columns and whatever more. My problem is a simple one. I'm working on a project that will use SQL Server. No problem there, since I...

Efficiency of Hibernate's table-per-subclass inheritance strategy

I'm thinking about table layout for a Hibernate-managed class hierarchy, and certainly the table per subclass technique strikes me as the most appropriate in a general sense. However, thinking through the logic I have some concerns about its performance especially as the number of subclasses scale. To give a very brief (and classic) ex...

What are Parent-Child relationships?

Hi, What is the parent and what is the child in a sql relationship? In my case, I have a part (Say screw), and product material. For argument's sake, a product material (eg steel) can only belong to one part (but not in the real world). So this is 1:n. The part will have its pk as a fk in the ProductMaterial table. Which is parent and...

Is it important to use InnoDB and transactions for an auction

I wanted to know how important it is to use InnoDB table and transactions for an auction website. I know that when there is payment involved the transactions are important, but in this case, there are only bids placed. The bids that are placed however are placed very quickly, maybe a few every second. I was wondering if i couldn't ju...

Use of null values in related tables with foreign key constraints

I have the following tables: Cateogories CategoryID (int) Primary Key CategoryName (varchar) Items ItemID (int) Primary Key CategoryID (int) ItemName (varchar) There is a foreign key constraint on Items.CategoryID. There is a chance that when a new item is created that there will be no category assigned. Is it better to set It...

Manufacturing Products Database Design

I am designing a database from scratch from manufacturing products. The key design is as follows: (Currently I am working on MS Access 2007 but my final implementation is SQL Server i.e. SQL Server 2008 being the latest version. Also I would be using only Express edition at this movement. The application will involve a .NET storefront in...

PHP Web Application: mysql database design best practices question

Hi All, I am currently in a debate with a coworker about the best practices concerning the database design of a PHP web application we're creating. The application is designed for businesses, and each company that signs up will have multiple users using the application. My design methodology is to create a new database for every compa...

database struct diagram

What are good references for database design diagrams? Examples would be nice. ...

Modeling Existential Facts in a Relational Database

I need a way to represent existential relations in a database. For instance I have a bio-historical table (i.e. a family tree) that stores a parent id and a child id which are foreign keys to a people table. This table is used to describe arbitrary family relationships. Thus I’d like to be able to say that X and Y are siblings without ha...

Advanced Database Design - Whats the most effective way to execute the following...

I am good with ideas, but due to my limited programming experience I sometimes strain to come up with the most effective solution for a given concept. Currently my mind is trying to fathom the most efficient way to reference a database table specific to a data type. Concept I am building an admin interface that allows a site owner to '...

design for 'simple' inventory system

Hello! I want to make a relational database system for a local computer hardware non-profit. There are two inter-related features that I want to figure out how to implement. First, we need to manage our inventory of parts, and second, we need to track donations of computer systems as they come into us, and also as we grant them out. Fir...

SQL - naming of ID columns.

Hi, I've always wondered what are the pros and the cons of these ID naming styles in SQL: CREATE TABLE cache ( id INT AUTO_INCREMENT, PRIMARY KEY(id) ); CREATE TABLE cache ( cid INT AUTO_INCREMENT, PRIMARY KEY(id) ); CREATE TABLE cache ( cache_id INT AUTO_INCREMENT, PRIMARY KEY(id) ); Why some developers use "id" in each table, som...

Pitfalls in prototype database design (for performance viability testing)

Following on from my previous question, I'm looking to run some performance tests on various potential schema representations of an object model. However, the catch is that while the model is conceptually complete, it's not actually finalised yet - and so the exact number of tables, and numbers/types of attributes in each table aren't d...

Should I write table and column names ALWAYS lower case?

I wonder if it's a problem, if a table or column name contains upper case letters. Something lets me believe databases have less trouble when everything is kept lower case. Is that true? Which databases don't like any upper case symbol in table and column names? I need to know, because my framework auto-generates the relational model fr...

Designing databases: storing user stats in games(i.e. owned money) and 32bit integer overflow.

Hello, I am creating an little hobby database driven browser based game and I stumbled across this problem: I store money owned by users as an 32bit integer field (to be precise: two fields. One stores money in players hand, the other - money stored in bank). We all know, that maximum value, which can be stored in 32 bits is 2^32-1. I ...

What to name column in database table that holds versioning number

I'm trying to figure out what to call the column in my database table that holds an INT to specific "record version". I'm currently using "RecordOrder", but I don't like that, because people think higher=newer, but the way I'm using it, lower=newer (with "1" being the current record, "2" being the second most current, "3" older still, an...

Flat File Database Example

I would like to see some examples of simple flat file databases and how they are accessed through a data layer. I've written to and read from a flat file before, but I have not ever created a data layer that accessed the data for an application using text files. If possible, it would be nice to see a tutorial that had a data layer that ...

What software should I use for manually drawing schema diagrams?

Our application has a fairly large, sprawling DB design, with 175 tables. Most tables are used by one or two primary features, and I'd like to create several little "mini-schemas" to describe the structure of different parts of the system to new hires (without showing them the gigantic total schema which is, frankly, so big as to be use...

What type should I use in Database and Objects using Linq-to-SQL for floating point?

I have 2 fields and I need these to be a floating decimal point. I wonder what data type to use while I'm designing bottom-up Linq-to-SQL classes. EG: one value is 1.427600, another value is 1765.030, both would be in the same property/column. ...