database-design

Techniques for reducing database queries in a Rails app

If you have a Rail app with many complex associated models, what techniques do you employ to reduce database queries? In fact, I'll extend that question a little further and ask, what do you consider "too many" queries for any page? I have a page that I expect will end up hitting the database about 20 times each page load. That concern...

How can I tell if a database table is being accessed anymore? Want something like a "SELECT trigger"

I have a very large database with hundreds of tables, and after many, many product upgrades, I'm sure half of them aren't being used anymore. How can I tell if a table is is actively being selected from? I can't just use Profiler - not only do I want to watch for more than a few days, but there are thousands of stored procedures as well,...

designing database

Hi, Basically my job is to develop web applications using a database as backend. What I have been doing till now is, Basded on the requirement of the client, I draw a basic sketch of what the tables are ,how they look like fields in those tables and some one-to-one or many-to-one or many-to-many relations Although I am not perfe...

Creating a relational structure

Scenario: I have some MAIN_TABLE1 MAIN_TABLE2 these main tables are in relational schema. Now, I need to move the data from this relational schema to some other flat tables: flat_Parent_Table flat_Child_Table1 flat_Child_Table2 flat_GrandChild1 flat_GrandChild2 Now one record from MAIN_...

what is the best way to create this database

hello what is the best way to create a database for Questions and Answers Script the user can submit a question with a set of choices among which the right answer exists the database must save the question, all the choices and the right answer. the best way that comes to my mind is to make 2 tables: Questions Table: ID Question Rig...

A Beginner Question on database design

Hi All,this is a follow-up question on my previous one.We junior year students are doing website development for the univeristy as volunteering work.We are using PHP+MySQL technique. Now I am mainly responsible for the database development using MySQL,but I am a MySQL designer.I am now asking for some hints on writing my first table,to g...

How SQL Server processes simultaneous requests?

If multiple queries to one and the same large table come to SQL Server at the same time, how SQL Server resolves conflicts in this case? When using LINQ to SQL queries in WPF application for install on many PC's, working in network with SQL Server database, should I somehow implement mechanism for resolving such issues or am I protected...

Handling tables of different types in ASP.NET MVC

I am designing a database for an ASP.NET MVC application. I'm an expert in neither, and I'm curious what the best approach would be for the following database snippet: We will be storing Events in our database. Each event will be of a different type with various fields exclusive to one or some of the types. An example: Events * Id *...

How to design this database table concept?

Suppose I have a table Articles. An article can have only one topic attached to it. But it is also possible that article has no topic. Should I make topic a new column in Articles table? OR Should I create a table topics2articles and map together a topic with article? (In this case I do not have to add extra column for Articles table. ...

What are database NULL fields for?

Could anyone explain the usage of NULL in database tables? What is it used for and how is it useful? Thanks, Boda Cydo. ...

CouchDB for a forum?

Will couchDB be better for storing the forum posts/topics then MySQL? assuming there is proper caching (i.e memcached being used). It seems at first glance that CouchDB is made for this, the whole document orientated design fits perfectly but I'm more concerned about performance. Any suggestions? ...

Google Contacts Address Book Schema - How to have 1 to many fields for data?

In Google Contacts, it seems that it allows you to many as many Email Address', Telephone numbers, Address', etc as you wish. You can simply keep clicking the add link to make as many fields as you want. This makes me curious on how this is made in a schema? ...

How important is it to select the smallest possible data type when designing a database?

How much of a difference does using tinyint or smallint (when applicable) instead of just int do? Or restricting a char field to the minimum characters needed? Do these choices affect performance or just allocated space? ...

What is wrong with this SQL schema?

I'm designing my first database for MySQL and the idea here is that we have orders that can contain multiple different items. So i decided to store order with all the relevant info in one table, items in another, and then create a third table where each ordered item is stored. Of course every time i will need to list an order i first wi...

Ideas for tagging system - should I categorize tags?

Hi guys, I built a simple website which allows users to post their profiles, classifieds and events. Now the thing is that I have a generic tagging system in place here. A user can add tags to define his/her profile, classifieds and events. As an as a user includes new tags - I noticed that certain tags a user uses in certain places bec...

Accessing tables from different .mdb files

I need to show a grid of saved projects (compare "orders") in a datagrid, where the projects are saved in an Access 2000 database with a similar schema as follows: ID Name Country_ID Plant_Type 1 'Test' 1 1 2 'Second' 2 2 Let's call the file "Projects.mdb". This is then showed in the data...

Database Design - NULL Foreign Keys

Hello, and thanks for reading. I'm making a DB for a puppy shop. I have a table for puppies and a table for owners. A puppy can have one owner, owners can own more than one puppy, but not all puppies are owned. What's a good way to handle this situation? Do I use a FK in the puppy table that is NULL if the puppy doesn't have an owne...

database schema design about clothes

Hi guys, I'm working on a fashion store's inventory control, but stuck at the clothing model. There should be a Style class, public class Style{ String styleNumber; String[] colors; String[] sizes; int quantity; } And also a detail Garment: public class Garment{ Style style; String color; String ...

Advice on data capture management system

Hi, I'm looking at a potential piece of work involving a fairly complex data capture and management site and am wondering how best to approach it. I would be using a LAMP architecture. The backend will involve: Mass user creation via user uploaded csv file - I have done this before so am confident about this part. Once registered, us...

MS Access: programmatically rename columns

I need to update all column names in an Access database of 8 tables. In short, each underscore in a column name should be replaced with a space. Can you recommend a fast method for doing this? ...