data-modeling

Database design question regarding multiple one-to-many relationships and foreign keys

In my database there are four databases: Teachers, Students, Parents and Addresses. Teachers, students, parents can have any number of addresses (zero or more). I would like to use foreign keys to link between teachers and their addresses (and between students and their addresses etc). Since records in Addresses can originate in eith...

Over Simple Database Schema: Good and Bad points? with example

I apologise for the long-winded, rantyness of this but I'm up at 3am dreading having to go to work tomorrow and deal with this database... it just feels wrong but maybe I'm wrong and just like things done my way... Please tell me what you think. Our database schema looks something like: page: id, label, contentid, parentpageid content...

Performance benefit in this data model ?

I have a MySQL(innodb) table 'items' with the following characteristics Large number of rows, and keeps on increasing. Large number of columns of various data-types including 'text'; primary key 'item_id' is present. There are additional requirements as follows: Need to query items based on their status Need to update status...

Updating Linking Tables

I've currently adding a bit of functionality that manages holiday lettings on top of a CMS that runs on PHP and MySQL. The CMS stores the property details on a couple of tables, and I'm adding a third table (letting_times) that will contain information about when people are staying at the property. Basic functionality would allow the us...

Venue/Event Booking Database Design

I am task with designing a database for online bookings. I am not looking for a full design as we have had previous exp with online house rental. What i would like to know, is how do we design a db for booking of hotel, travel, events. We have some ideas. Basics... Have all venues/ events (once/reoccuring) register. That seems like ...

database design for unread meassages in mysql?

What would be the best way to check unread messages from mysql table... I have two tables one for users and the other for messages... In the users table I am saving the last-login-date column & in messages table the date-added column, but what would be the best way to check whether the user has accessed the messages or not.... I am think...

Unable to create column in MySQL database with datatype of TEXT

I'm creating a table to hold items from rss feeds and I need to create a column 'description'. I selected the datatype as TEXT with no limit set with no index on this column. This is the error I'm getting: #1071 - Specified key was too long; max key length is 1000 bytes If I select to index this column, I get this error message: #117...

Person -> Details database structure

I have a Domain model: Employee: Id, FirstName, LastName, Sex, BirthDate. Office: Employee, WorkStation, OfficeName, etc.. Contacts: Employee, MobilePhone, EMail, etc... But I`m not sure about my current database structure. How is right: Employees table has a PK EmployeeID, and the Offices and Contacts tables has their own IDs and r...

model classes in a database with my own enum types

Hi, I have an application that I need to query lifetables (for insurance calculation). I was thinking about using XML to store the data, but thought it was a little big, but maybe a little small for using a full-fledged database. So I chose to use SQLite. In my application, I have enums defining a few different things. For example, GEN...

Ways to circumvent a bad database schema?

Our team has been asked to write a Web interface to an existing SQL Server backend that has its roots in Access. One of the requirements/constraints is that we must limit changes to the SQL backend. We can create views and stored procedures but we have been asked to leave the tables/columns as-is. The SQL backend is less than ideal....

5 separate database or 5 tables in 1 database?

Let's say I want to build a gaming website and I have many game sections. They ALL have a lot of data that needs to be stored. Is it better to make one database with a table representing each game or have a database represent each section of the game? I'm pretty much expecting a "depends" kind of answer. ...

Database Design for Document Library

We are attempting to built the Document Library (File Management) as apart of our core apps. It starts with simple one obviously. I need a feed back regarding the database design for this particular module. Initial Design: File table: FileID FileGUID TenantID FileName FileDescription FileImage FileSize FileExtension ContentType Crea...

Database Design: Alternate to composite keys?

I am building a database system and having trouble with the design of one of my tables. In this system there is a users table, an object table, an item table and cost table. A unique record in the cost table is determine by the user, object, item and year. However, there can be multiple records that have the same year if the item is di...

Database design software for a student?

I am taking a database class and have to draw a bunch of different kinds of diagrams. Specifically, I need to draw ERD and dependency diagrams. The instructor does not want any hand drawn diagrams but does not offer any clue as to what software to use. Does anybody have any suggestions? ...

Under some circumstances an App Engine "get_by_key_name" call using an existing key_name returns None

I've run into a strange problem that I haven't seen before making a get_by_key_name call using the App Engine ORM. Under no circumstances, one would assume, would the following return None: Model.get_by_key_name(Model.all().get().key().name()) And yet, that's what I've found that certain key names will do. It's only in a few cases w...

Can you provide some advice on setting up my database?

I'm working on a MUD (Multi User Dungeon) in Python and am just now getting around to the point where I need to add some rooms, enemies, items, etc. I could hardcode all this in, but it seems like this is more of a job for a database. However, I've never really done any work with databases before so I was wondering if you have any advic...

trying to figure out the best database schema

i want to come up with a generic (if possible) schema to use for a number of different events that i am managing. These events can be weddings, birthday parties, etc So for i have 3 main tables Contact Table - with the usual info like address, phone, etc Events Table - list of events with some info like date, location, etc Now i am t...

mysql - user item ratings, 1 rating per user, updateable - table structure?

I'd like to give my users the ability to rate each item on the site from 1 to 5. They also must be able to go back and revise their rating for each item as they please. Lastly, the item's page will display the average-to-date of all user ratings when viewed. As for the PHP, I think I can handle that. What I'm struggling with is envision...

How to do Inheritance Modeling in Relational Databases ?

Hi, My question is regarding Inheritance modeling in Relational Database Systems. I have canonical data model and in that I have some fields related to pricing of product inheriting certain attributes from product table and I want to model this inheritance in MySQL relational database and so, "How can we do Inheritance Modeling in Re...

Modeling A Book With With Ruby on Rails Active Record

Im modeling an online book with ruby on rails. The book has chapters, each chapter has pages. Modeling this part is easy. What id like to do is keep track of what pages each user has read and when and whether they liked that page / whether the user completed the book. How would one recommend modeling keeping track of this in rails? Id id...