database-design

What is the best way to optimize schema for capturing attendance data

We have a sports training camp which is regularly attended by various teams in the city. We have a session per day spanning 2 hrs(9-11 AM) and the time slots could vary for different teams. We would like to capture who attended the training camp on a daily basis. We arrived at the following model to capture attendance. (id, user_id, dat...

Database Design for 2D Matrix Algebra

Hi, Can anyone advise on a database design/DBMS for storing 2D Time Series Matrix data. To allow for quick BACK END algebraic calculations: e.g: Table A,B,C.. Col1: Date- Timestamp col2: Data- Array? (Matrix Data) SQL Psuedo Code INSERT INTO TABLE C SELECT Multiply A.Data A by B.Data Where Matrix A Start Date = Matrix B Start Date...

Notations in Data Modeling (Crow's Feet etc)

What are the standard notations in database modeling. Visio offer two types, The crow feet notations and simple arrows. So which are the industry standards? I am very new in Database modeling and design stuff so please excuse if my question is too dummy. ...

OODBMS postgreSQL array Fields real Use ?

I am new to PostgreSQL, mainly used MySQL before and SQLServer(for Clients Pressure; donno much), I've gone through several OODBMS Introductories over some Google Search. Most of them mainly focuses on Table <-> Object Mapping. But When using some Generic ORM Layer with any RDBMS Things are Hapily Mapped. So do we really need OODBMS ? I...

[Database design] Modeling temporal logging across multiple nodes

Hello, I am creating a database for an application that logs data for several different nodes. The data logged looks like this: timestamp several integer values several floating point values maybe a string or two Each node is polled separately. I would be creating a log entry between every 10 minutes and every 10 seconds (variable ...

This is wrong: a column can references primary keys in different tables depends on value of another column?

One of my colleague designed a table schema, and in one of the tables a column can references primary keys in different tables depends on value of another column. I know it is differently wrong, but can not find theory to support me. His schema like this: table video: (id, name, ...) table audio:(id, name, ...) table review_item( item_t...

Any suggestion for DB datatable design for this issue?

It's a little complex. I'll try to be as clear as I can. It's a work plan. We make estimation of the total time needed for a task, say 100 hours, and break it into periods of month. For example, 30 hours should be done in March, 20 hours in April, and 50 hours in May. After every month, the plan can be changed. I need to keep both the...

What are the advantages of explicitly setting up relationships inside of a database.

When your creating a database schema and come up with all the foreign keys. What are the advantages of explicitly defining them as such in the database? Are there advantages? If it's reliant MySQL is the db I will be using. ...

MySQL - how to front pad zip code with "0" ?

In my MySQL InnoDB database, I have dirty zip code data that I want to clean up. The clean zip code data is when I have all 5 digits for a zip code (e.g. "90210"). But for some reason, I noticed in my database that for zipcodes that start with a "0", the 0 has been dropped. So "Holtsville, New York" with zipcode "00544" is stored in m...

What willl be the fast method for a domain store in MySQL??

I want to store domain names(example:google.com - without "http://" and "www")in MySQL as primary key+Index. so when I call a domain through PHP I should get the result according to that domain faster. Right now I am inserting domain in plain text. is it right way to do it?? or do I need to hash it?? your Ideas please ...

SQL Server / TSQL Updating a table with a unique constraint

Hi, If I have two tables, say: Clients ( ClientID int primary key, ClientName varchar(50) not null ) and Addresses ( AddressID int primary key, AddressLine1 varchar(50), etc.. ClientID int not null, IsPrimaryAddress bit not null ) with a unique constraint across (ClientID, IsPrimaryAddress), how can up date those tab...

Composite Clustered Index in SQL Server

Hi, I have a table with a IDENTITY Column as Primary Key (a classic ID column). SQL Server create automatically a Clustered Index for that Primary Key. My question is: Can I have a only single CLUSTERED INDEX composite with more columns? If yes, how can I drop the default clustered index and recreate a new one with this attributes...

Design a database with or without inheritance

Hello, I am trying to understand inheritance and how to use it with PostgreSQL. For this reason i design a database in the excel file. In the 1st columns you can see the table w/o inheritance while in the 2nd part of the sheet you can see the tables with INHERITANCE. Can you give me your opinion and help on the following? 1. Which is th...

Need help deciding on a database scheme for a reporting project (PHP)

Update: I'm not looking for someone to come up with a schema for me. I guess I'm looking for input on whether some normalized DB design would work, when I can't clearly define all the relationships of the entities I'm working with, or if something more along the lines of a data warehouse would be something I wanted to ...

Database Design Questions - Need Clarifications

hi guys i m designing a database using sql server 2005 main concept of our side is to import xml feeds from suppliers different supplier can have different representation of data the problem is i need to design table to store imported information some of the columns are fixed means all supplier products must have similar data comi...

How to log user actions to db using the Zend Framework

Hi guys, I am building a cms at the moment using the zend framework and have implemented a text based log which will log any errors and allows me to log any custom messages I may want recorded. As part of the cms I need to provide some sore of revision history for pages, blog posts etc. My thoughts on this were to simple have a logs ta...

Numeric types and row size in MySQL

I have a user table structured like this: id MEDIUMINT(7), username VARCHAR(15) Would it technically be faster if I changed it to this instead: id MEDIUMINT(5), username VARCHAR(15) I'm confused because even though the total row length in terms of characters and digits would be shorter, I assume the number of bytes used would b...

Best Design for Passing Filter Set into Database Class for SQL use

I'm developing a FlashCard App. Part of this is giving the user the option to filter results on difficulty level and category (more options in the future probably). See the image for a quick mockup of the user screen. The data for the flash cards are stored in a Derby DB in a single table. One column for Level. A column for each catego...

Few database design questions relating to user content site

Designing a user content website (kind of similar to yelp but for a different market and with photo sharing) and had few databse questions: Does each user get their own set of tables or are we storing multiple user data into common tables? Since this even a social network, when user sizes grows for scalability databases are usually par...

How does one deal with multiple TimeZones in applications that store dates and times?

I realize this is a bit subjective, but I'm hoping to pick everyones brain here on how they deal with multiple timezones? There are a variety of similar questions here and an equally wide variety of accepted answers. How have you delt with this in apps you've built, and what issues did you have to overcome? ...