database-design

Best Approach to Processing SQL Data problem

I have a Data intensive problem which requires a lot of massaging and data manipulation and I'm putting this out there to see if anyone has an idea as to how to approach it. In simplest form. I have a lot of tables which can be joined together to give me a price listing for dentists and how much each charges for a procedure. so we hav...

Matching, ranking based on relevance of each criteria

I have a growing database containing: a table of demands (multiple criteria) a table of offers (multiple criteria) Criteria can be string (e.g.: country name), boolean, numeric, ... I would like to find all demand-offer which match more or less (a little like job banks, matchmaking, ...) If tables didn't contain many rows I would c...

Getting started with Azure Storage coming from a relational database point of view

I'm designing a new system, and I have need to store a pretty large volume of different type of data, with realitivly few rows per type. I know that if I were doing this with SQL Server (I don't want to use a SQL Azure database for this.) I'd make a new table for each type of data and make the correct relationships. I'm wondering if any...

One database, multiple customers

Hi all, I'm currently coding a product which will have only one database but will host many clients by using a global identifier of a customer_id. This is all very good. However, let's say we have a table called Ticket. Idea has a primary key. When a user adds a ticket, the ticket will correspond to the customer via a foreign key etc....

MySQL: how to ensure integrity in multiple read only architecture

Scenario is simple to describe, but might have a complex answer: Imagine a case where you have one write only mysql database. Then you have about 5 or 6 read only databases. The write database has a count for a particular inventory. You have hundreds of thousands of users banging away at this particular inventory item, but only limited ...

Can I edit AutoNumber Column in Access?

I've lost my data in Access base, and I've manage to bring them back but when I copy the values in the table with the AutoNumber Column it increments the numbers. Is there Any way to change it to int and then bring it back to AutoNumber? ...

Self-referential has_many :through with customized :primary key issue

I'm trying to emulate the twitter model in my Rails 2.3.8 app (ruby 1.8.7) class Connection < ActiveRecord::Base belongs_to :subject, :foreign_key => 'subject_id', :primary_key => 'user_id', :class_name => 'User' belongs_to :follower, :foreign_key => 'follower_id', :primary_key => 'user_id', :class_name => 'User' end class User < A...

Is this a suitable SQL schema for a site similar to StackOverflow?

I'm trying to create a site similar to StackOverflow. I just created a SQL schema today and need some feedback on what needs improvement. Here's a link to the schema (Requires MySQL Workbench) Here's a picture of the schema: Is there anything I can do to improve this schema? ...

Problems designing / mapping dynamic data-entry value store

This is tightly related to a previous question I had. It's a row/column view where columns can be several different datatypes and each row might have a value for each column. I thought of having the following structure case field fieldType bool_values fieldId caseId value int_values fieldId caseId value ...

Database design: flexibility vs. simplicity

I am trying to weigh up the relative pros and cons of a simple database structure such as this: 1. CREATE TABLE x ( my_id INT PRIMARY KEY, ..., text_attribute_blah TEXT, text_attribute_blah_blah TEXT ); vs: 2. CREATE TABLE x ( my_id INT PRIMARY KEY, ... ) CREATE TABLE attributes ( my_id INT, /* foreign...

Database design - google app engine

I am working with google app engine and using the low leval java api to access Big Table. I'm building a SAAS application with 4 layers: Client web browser RESTful resources layer Business layer Data access layer I'm building an application to help manage my mobile auto detailing company (and others like it). I have to represent the...

Whether to normalise a results table or not

In our inventory database (SQL Server 2008 std edition) we have a table (called Stock Results) that stores results for each stock item by stock period, that looks like this: << StockResults >> PK StockPeriodID int PK StockItemID int OStockCost money OStockQty real DeliveriesQty real CreditsQty real TransfersInQty real TransfersOu...

MySQL: UPDATEing a row with no guaranteed unique field

I am working with an old MySQL table, which serves as a log of sorts. It looks like CREATE TABLE `queries` ( `Email` char(32) NOT NULL DEFAULT '', `Query` blob, `NumRecords` int(5) unsigned DEFAULT NULL, `Date` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Now, I need to be able to UPDATE the records in this table ...

how are viewing permissions usually implemented in a relational database?

What's the standard relational database idiom for setting permissions for items? Answers should be general; however, they should be able to be applied to example below. Anything flies: adding columns, adding another table—whatever as long as it works well. Application / Example Assume the Twitter database is extremely simple: we have ...

User account types values

I have the current Account Type reference table with these values : Admin, Employee, Test, User. So all user account will be like ID =04. But I am worried that while creating an account, may be the system may screw up the ID and give the user a 01, 02 or 03 then they will get admin rights into the site. Is there a better way to define ...

Appointments and Line Items

I'm building a management application to help manage my mobile auto detailing company (and hopefully others). I'm struggling to figure out how to model some of the data. This question is related to a previous question that I've posted, but I've reproduced the relevant information below: http://stackoverflow.com/questions/3120192/datab...

How do I optimize MySQL queries?

I'm currently using mysql w/ PHP because that's what I learned and haven't ever had to use anything else. In my current project, I have a database w/ 10 million rows and about 10 columns and have found it to be very slow when I do complex calls, both in a local (windows) environment as well as production (linux) environment. Both servers...

Database records revision

Hi, I have to questions concerning database records revision. First of all I have database table with name and content columns. I want to have "backup" versions of the content (and maybe name) column saved plus the user, who made this edit. Is it better to have an audit table with previous versions (and should I keep only the changed co...

How to design this RDBMS schema?

So we have foods, which are usually of one single unit and recipes, which consist of varying amount of different foods. We want to track a few basic things like the price and the nutrition info. How would we design RDBMS schema for this? So, here is the probably most obvious solution: [Foods] : ID, Name, Carbs, Protein, Fat, Price [R...

Relational database Design- Relationship problem

Hi I need to create database tables to store memo. in the "To" clause user may select individual employee or group of employees (Different groups are already available in database having many to many relationship with employee). i am wondering what should be structure of tables. For simple memo where there are no groups i will have "Memo...