database-design

Discovering the subclass of a row in the superclass table

I have a table of electronic devices that serves as a generic superclass and then separate subclass tables for phones, laptops, cameras, etc. that extend the superclass and give specific information on the device (using the foreign key deviceID from the superclass table), in other words, Class Table Inheritance. My question is, should I ...

Cursors vs duplicate code/logic

Hello, I heard it's not good to use cursors, as they "unnatural" to DBMS and they provide bad perfomance. But imagine the following situation: I have a stored procedure and I need to call this stored procedure for every customer from France (for example). I have a few options, such as using cursor, write all stuff in one query and call s...

Any drawbacks to storing an integer as a string in a database?

I have id values for products that I need store. Right now they are all integers, but I'm not sure if the data provider in the future will introduce letters or symbols into that mix, so I'm debating whether to store it now as integer or string. Are there performance or other disadvantages to saving the values as strings? ...

Best way to store product size/quanties in a database?

Hello all, I'm building a custom shop and one thing that none of us here can agree on is how we should store the size/quantity fields for a product. I easily can't find information on this and am wondering how people have tackled this before? Currently we are thinking of either storing the complete size/quantity information in somethin...

Column Naming Advice

I know there are other naming convention discussions, but the ones I saw were all general guidelines, I'm asking more for advice on good practice regarding my specific case. However, if there is another question that directly covers my case, please link it and I will gladly delete this question. I have a database for modeling electronic...

Is SQL outdated?

A friend of mine who is a computer scientist told me he thinks SQL is a thing of the past. I used SQL for years and think the language is totally relevant when dealing with database specific tasks. My friend believes the new frameworks (e.g.: django, etc) that are coming out are making things even more generic, making SQL an outdated d...

tutorial on database design using dbDesigner or other tool?

Is there any tutorial on how to do a database design using dbDesigner or any other tool. ...

Database design: To normalize or not to

I am creating a light RPG game where a character is able to equipment a weapon, an armor and 2 accessories slot. Here's one possible solution: equipped_equipment(<characterid>, <equipmentid>, <slotid>) slot(<slotid>, slotname) equipment(<equipmentid>, equipment_name, equipment_script_name) So, to find out what weapon the character is ...

SQL 2008 data types - Which ones to use?

Hi I'm using SQL Express 2008 edition. I've planned my database tables/relationships on a piece of paper and was ready to begin. Unfortunately, when I clicked on data type for my pkID_Officer I was offered more than I expected, and therefore doubt has set in. Can anyone point me to a place where these dates types are explained and exa...

2008 SQL EXPRESS stored procedures - mine are missing

Hi I'm using VWD 2008 (SP1) and SQLExpress 2008. I'm creating a database first and then looking at using DynamicDataControls (seem useful and staright foward for a beginner like me). Within VWD I created a new Dynamic Data Web Application. Then I added a new SQL database item. I noticed that this doesn't include stored procedures or......

SQL Express 2008 - what's a reasonable aplication size for it's 'limitations'?

Without wanting to sound too stupid, SQL Express is free and the free resources make it a good choice for a beginner like me. I know it has limitations (read other posts) but the figures mean little to me I'm afraid. Can anyone give me ball park figures on the number of users it can handle? I'm looking at possibly 40-50 users maximum,...

Stumped and Seeking Input Re: Database Design

We have an Oracle database here that's been around for about 10 years. It's passed through a lot of hands. In the course of those years, it's grown quite large, and there are some interesting anomalies in its design that have me perplexed. Now, I'm historically a SQL Server developer. I used to steam and fume about the differences betwe...

Create a join that can (include some) or (include all except some) records

Consider the following two tables: User - UserID - UserName Group - GroupID - GroupName The obvious association is that Users will be in Groups. This by itself is a simple many-to-many join situation, so lets add a 3rd table: UserGroup - UserID - GroupID Under this textbook schema, I can easily include a specific User in a s...

Please help explain if I'm destroying my DB Schema for the sake of performance :(

Hi folks, I've got a database in production for nearly 3 years, on Sql 2008 (was '05, before that). Has been fine, but it isn't very performant. So i'm tweaking the schema and queries to help speed some things up. Also, a score of main tables contain around 1-3 mill rows, per table (to give u a estimate on sizes). Here's a sample datab...

School Database Design Required.

I am planning to build a database for a school application. I have designed a database to hold time tables for all the classes. It should also relate to the teachers taking the subject for the class. Also should be able to handle a public holidays mentioned. Also the attendance of all the students and teachers. Please guide me with the...

Northwind traders unitprice redundancy?

In the northwind traders database unitprice is listed on both the products and [order details] tables. Both tables list different prices for the same product. Is this a redundancy or is there an explanation for this? ...

Using a bitwise flag for a primary key?

I am designing a database and was thinking about the need for a one to many relationship. Traditionally I have done the normal PK (as a GUID) and set up the relationship, but I was wondering instead if doing that why not use a bitwise flag as the PK. The relationship would be lost but the data itself would describe the relationship. E...

Best way to link a table to 2 different keys ?

Hi, I'm designing a mySQL DB and I'm having the following issue: Say I have a wall_posts table. Walls can belong to either an event or a user. Hence the wall_posts table must references either event_id or user_id (foreign key constraint). What is the best way to build such a relationship, considering I must always be able to know who ...

What is the best approach to storing location information in a database?

The location data is essentially in a tree structure. So when you ask someone for their address you would like to know what Area/Suburb, City/Town, State/Province and Country that they live in. This data will hopefully be set up only once and need very little modification. Most E-commerce sites and a lot of others would need to store th...

Storing Signals in a Database

Hello, I'm designing an application that receives information from roughly 100k sensors that measure time-series data. Each sensor measures a single integer data point once every 15 minutes, saves a log of these values, and sends that log to my application once every 4 hours. My application should maintain about 5 years of historical da...