database-design

How to model time representation in the schema

We currently store the hours, minutes part separately to capture time (e.g. 10.30, 14.30). Is this the best way to model time representation (supported databases are h2, mysql, postgres) ...

Best software (or other) solution for modeling existing complex MySQL schema

Hi Stack Overflow, What's a good solution for modeling an existing and very complicated MySQL schema. Preferably with the following features: completely visual drill down on click shows keys, indexes gives sample data per field* *as fields aren't always intuitively named Thanks! Emile ...

Database Design: Handling merge/divide of keys

I am trying to design a data warehouse for a state government where data about individuals may arrive from multiple agencies. These individuals may or may not have SSN's or Tax IDs -- think homeless people who are entitled to Medicaid, or data about incarcerated people from the department of corrections. As the data arrives the system wo...

Checkbox selection of database tables to include in Ruby on Rails view

I am working on a Ruby on Rails project where people can keep a diary for diseases or health conditions of their interest. They can (de)select multiple topics in their preferences with the help of checkboxes, and get disease specific questions and tracking options for their 'diseases of interest' on their personalized site. I am not very...

How do I organize/store a "type" field for a comments table?

My application has about half a dozen different types of items that a user can comment on (articles, photos, videos, user profiles, blog posts, forum posts). My plan right now is to have a single comments table in my database and then have parent_id and type fields in the table. The type field would just be a string and the contents of...

Does this exists as a cloud service?

Database Redis Casandra MySQL (RDS, while nice, isn't quite agile enough) (other besides RDS) PostgreSQL Queueing RabbitMQ Beanstalkd Gearman Full text search Thinking Sphinx ...

How can you represent inheritance in a database?

I'm thinking about how to represent a complex structure in a SQL Server database. Consider an application that needs to store details of a family of objects, which share some attributes, but have many others not common. For example, a commercial insurance package may include liability, motor, property and indemnity cover within the same...

How do I query a SQL database to return the first "page" containing the specified data?

------------------------ | | A | | ------------------------ | | B | | ------------------------ | | C | | ------------------------ -----Page 1 | | D | | ------------------------ | | E | | ------------------------ | | F | | ------------------------ --...

Storing all text content in a single db table

I'm building a multilingual website. I've been thinking about using a single table for all text content texts(key, language, content) that other tables can refer to. For example, let's say I have a table items(id, name, description). Instead of storing actual content, the name and the description columns store references to the texts t...

Fastest way to populate a Db

I have an excel spreadsheet with products and categories with a many to many relationship and i need to populate the db with it. I am searching for a quick way to enter this data in and have the join table have all the correct info. I have phpmyadmin but it seems to be a bit slow unless there is a shortcut. Another approach i was thinkin...

How to return "row number" of first occurrence, SQL?

(row number not stored in db) ------------------------ | | A | | (1) ------------------------ | | B | | (2) ------------------------ | | C | | (3) ------------------------ -----Page 1 | | D | | (4) ------------------------ | | E | | (5) ------------------------ |...

Database Design Help: Whose kid is this anyway...

I am building my wife a Contacts Manager program as a fun exercise in learning Silverlight 4. It will track peoples Addresses, Phone Numbers, Emails, Special Occasions(Birthday, Anniversary, etc) Along the way I hit a minor road bump while designing the Database. She would like to be able to group Contacts(people) by Family so I creat...

Database modeller for JPA with visual diagrams

I am looking for a tool to help in designing and implementing database and entities for a Java project. Probably we are using JPA or direct Hibernate. The features I look for are: Design database with visual modeller Create entities from the visual model Update entity changes to the visual model Import existing database schema as visua...

Peak Mysql. Status a queries "Sending data" and processor loaded on 100%

Server Mysql 5.1.49. The processor was suddenly loaded on 70-80% two days ago, after sleeping for the next day again loaded, and then slept, now the load is not falling. It was found that queries are executed rapidly compared to their sending to the client (in the status of MySQL stands Sending data). In table 3 values greater than 8mln....

How do you handle deletion of users

Users in our application participate in forums and create various entities. In the schema you mark references from those tables back to the User table as foreign key references. We are unable to remove this user entry from the database, since it has several foreign key constraints which can be removed. One way of addressing would be t...

Storing & Querying Heirarchical Data with Multiple Parent Nodes

I've been doing quite a bit of searching, but haven't been able to find many resources on the topic. My goal is to store scheduling data like you would find in a Gantt chart. So one example of storing the data might be: Task Id | Name | Duration 1 Task A 1 2 Task B 3 3 Task C 2 Task Id | Predecessors...

Programmatically managing a 'balance' of time (sick/vacation)

I'm using Python/Django, but this is more about the "data model" and how I interact with the information - I really just want to know if I'm crazy here. I'm working on a small app at my company (~55 employees) that will keep track of available Vacation/Sick time. Part of the purpose is to integrate "self-service" into our intranet, so ...

How to design DB with parent-child relationships?

If I needed to represent, say, locations (e.g. countries, states/provinces/regions, cities, etc.) in a database, how would I do so in such a way that it would be easiest to query, scale the most, etc.? I plan to use this for an application that will allow users to select multiple locations and associate them to their profile. The soluti...

How to design a database with a table that needs to reference itself?

I'm building a database and have run into a problem that I can't seem to wrap my mind around. The database is much more complex than what is pictured, but the problem can be distilled into the table structure below. The issue is that every employee has a manager and every manager is an employee. It would seem that these tables have to...

Saving images from an sqlite table

I have an sqlite table w/ 500 records each with images stored as blob data. The images are all large size and I need to make thumbnail sized versions of each image and then save them in a separate field. Does anyone know what would be the optimum way of approaching this task? One other question - is it recommended to have a separate ta...