database-design

How to structure (normalize?) a database of physical parameters?

Hello: I have a collection of physical parameters associated with different items. For example: Item, p1, p2, p3 a, 1, 2, 3 b, 4, 5, 6 [...] where px stands for parameter x. I could go ahead and store the database exactly as presented; the schema would be CREATE TABLE t1 (item TEXT PRIMARY KEY, p1 FLOAT, p2 FLOAT, p3 FL...

Database design question

I have an interesting database design problem that I formulated while travelling by a bus, coming back from my home. Design a normalized database for a bus ticketing system (not reservation system). In each trip, the conductor of the bus will give tickets to its passengers after collecting fare from them. Passengers travel from a variou...

Synonym for "Many-to-Many" relationship (relational databases)

What's a synonym for a "many-to-many" relationship? I've finished writing an object-relational mapper but I'm still stumped as to what to name the function that adds that relation. addParent() and addChild() seemed quite logical for the many-to-one/one-to-many and addSuperclass() for one-to-one inheritance, but addManyToMany() would sou...

Would you use one or two tables for username and password?

Is it any safer to create a table holding user information and another one for their passwords than using the same table for everything? ...

NULL in table fields better than empty fields?

i wonder if one should have NULL in the fields with no value, or should it be empty? what is best? thanks ...

How to store opening weekdays in a database

I have a group of checkboxes where the user selects some of the weekdays (the opening days of a store). How can I save the selected days? Should I save something like 0111111 (zero means closed on sunday) on the same field and split the result when reading the data? Or create a field for each day and store 0 or 1 on each (weird)? ...

How do I calculate a good hash code for a list of strings?

Background: I have a short list of strings. The number of strings is not always the same, but are nearly always of the order of a “handful” In our database will store these strings in a 2nd normalised table These strings are never changed once they are written to the database. We wish to be able to match on these strings quickly in a...

database design to speed up hibernate querying of large dataset

I currently have the below tables representing a bus network mapped in hibernate, accessed from a Spring MVC based bus route planner I'm trying to make my route planner application perform faster, I load all the above tables into Lists to perform the route planner logic. I would appreciate if anyone has any ideas of how to speed my per...

Invoicing vs Quoting or Estimating

If invoices can be voided, should they be used as quotations? I have an Invoices tables that is created from inventory associated with a Job or Order. I could have a Quotes table as a halfway-house between inventory and invoices, but it feels like I would have duplicate data structures and logic just to handle an "Is this a quote?" bit....

Database solutions for storing/searching EXIF data

I have thousands of photos on my site (each with a numeric PhotoID) and I have EXIF data (photos can have different EXIF tags as well). I want to be able to store the data effectively and search it. Some photos have more EXIF data than others, some have the same, so on.. Basically, I want to be able to query say 'Select all photos th...

Is it correct to represent a foreign key on a conceptual data model?

Is it correct to represent a foreign key on a conceptual data model, or should I only introduce foreign keys when I am doing the relational model? ...

Is it wise to use temporary tables?

Hi guys, We have a mySQL database table for products. We are utilizing a cache layer to reduce database load, but we think that it's a good idea to minimize the actual data needed to be stored in the cache layer to speed up the application further. All the products in the database, that is visible to visitors have a price attached to t...

Simple free database schema modelling tool

I need a simple tool for visually modeling a database schema for an SQLite database. I do not need it to generate code, I just want some visualization. I really liked WWW SQL Designer but when I use it locally I am not able to save or load anything. It is also very poorly documented as it is still relatively young. Can anyone suggest ano...

Parent-child table layout

I'm currently planning a piece of software for dogbreeders and I'm in doubt about my datadesign...whether I'm doing something smart or stupid :) The plan at the moment is one holistic "dog" table sorta like this... Id | Name | FatherId | MotherId ------------------------------- 1 | A | NULL | NULL 2 | B | 1 | NULL 3 ...

adding one time options to items

Hello, I'm building an Event Registration site. For any given event, we'll have a handful of items to choose from. I have a table for these items. For each event we might have special options for users. For example, for one of the events new users get to buy an item which is not available to other users. This may not apply to all t...

DB Design - Linking to a parent without circular reference issues

Hi all, I'm having trouble coming up with a solution for the following issue. Lets say i have a db that looks something like the following: Issue Table Id | Details | CreateDate | ClosedDate Issue Notes Table Id | ObjectId | Notes | NoteDate Issue Assignment Table Id | ObjectId | AssignedToId| AssignedDate I'd like allow the ...

Restating a primary key to identify an employee

Our company decided to designate a contractor by adding an "X" in front of the employee number. But they aren't doing this in all systems. Is this a dangerous thing to do and why? ...

Populating a foreign key table with variable user input

I'm working on a website that will be based on user contributed data, submitted using a regular HTML form. To simplify my question, let's say that there will be two fields in the form: "User Name" and "Country" (this is just an example, not the actual site). There will be two tables in the database : "countries" and "users," with "user...

How to plan for schema changes in an SQLite database?

I am currently developing an application that will store data in an SQLite database. The database will have much more read- than write-access (in fact, it will be filled with data once, and then almost only reading will happen). The read-performance is therefore much mre important. The schema I am currently developing is very likely to c...

Foreign keys - temporarily bypass?

Hi, I have just started to learn about the pros of foreign keys in database design (mySQL / innoDB) and I wonder if there's any way to temporarily bypass the foreign key when doing a specific delete query, to just delete in the parent table, and not from the linked child tables. Thanks ...