database-design

Storing Content with Complex Structure using Django

Is there a recommended best-practice for storing content that has a complex structure. For example, suppose a typical "article" I am trying to serve may have the following hierarchy: Header #1 Subheader #1.a) Text content Image content Text Content Subheader #1.b) Text Content Other complex content ty...

What is the best database design for multiple tables with 1 to 1 relationship to the same table?

For example, I have three tables that store different types of users with different data. But now I want to store their contact information. The table that stores their contact info would be suitable for storing data for all of the user tables. The problem is that I have different or possibly duplicating ID's between the different user...

How do I flag unread items of an RSS Feed?

I'm trying to do a RSS reader but I have no idea on how to identify the unread items. For example what should I do when I refresh my list to prevent having duplicates? ...

Linq to Sql inheritance mapping to multiple tables

I am having trouble with inheritance mapping in Linq to Sql. I am using MSDN as a reference and as a basis it sounds good. However the example it gives is a single table inheritance mapping. However, I am trying to do multiple table inheritance to save on table space. Is this possible? So far I have: [Table(Name="writing_objs")] [I...

Mysql foreign key by non unique key -- how is that possible?

I was migrating mysql database to postgres and stumbled across the following block in DDL (Note: This is what I got from mysqldump): CREATE TABLE `catalog_property_value` ( `id` int(10) unsigned NOT NULL, `property_id` int(10) unsigned NOT NULL, `sort` int(10) unsigned NOT NULL, `value_number` decimal(15,5) DEFAULT NULL, `valu...

SQL database design

I am making a database for a program where i am supposed to model some relations in the family. ex: X is father to Y , Y is son to X So , i have a Members table with all info about each member so i thought about making a many to many relation between the Members table and itself so that the Member_Member bridge table will be having the ...

MVP Pattern, n-tier application architecture in .NET

Hello fellow SO-ers. I'm at the beginning of my road concerning Programming and Software Development and Design. I want to develop some applications in .NET(C#) WinForms with a SQL server as back-end (haven't decided yet: PostgreSQL, MSSQL or other). What I want to ask is where do I get information on: How do i structure my SQL tables...

MySQL DB design help.

Hello All, Pardon the elementary question but my newness to the realm of database design leaves me in a bind quite often. I have a site that keeps growing with regard to families of information. In the beginning I had one sort of item I was describing and all was well. That item occupied one record and had 34 columns (a lot now that ...

When should database synonyms be used?

I've got the syntax down but I'm wondering if somebody can provide an illustrative use case where database synonyms are very useful. ...

Ideal sqlite database design

I am relatively new to db design, so any help here would be appreciated. I am working on developing an iPhone app, and keep getting stuck, so I'm thinking my database design is junk. In my app, I have basically three items I need to pull from a db. A book title value, a chapter number value, and a segment content value(comprised of a num...

Best Practices to Design multi-language web site database

Best Practices to design multi-language web site database. Technologies employed here are ASP.NET MVC and SQL Server. EDIT : I'm looking for table structure and relationship design. ...

Symfony + doctrine + one-to-many relationships

Hi everybody. I need a one-to-many relationships for my sf 1.4 + doctrine 1.2 project. I copied the relation just like this: User: columns: id: type: integer(4) primary: true autoincrement: true contact_id: type: integer(4) username: type: string(255) password: type: string(255) Ph...

How should I index this MySQL db?

I am creating a site that allows users to share specific pages to the public. It is similar to how jsbin.com let's you create a public url of the script you're working on. The basic MySQL table I am working with now is: CREATE TABLE IF NOT EXISTS `lists` ( `id` int(10) NOT NULL AUTO_INCREMENT, `hash` varchar(6) NOT NULL, `created_...

MS SQL: One Large, Multi-Column dbo.Person table or Multiple Subsets With Multiple Joins?

Hi, I am thinking through the layout of my "Person" table in my MSSQL DB. Is it better to have all columns in dbo.Person as such: Person ( personid first last email confirmcode isconfirmed homeaddress homecity homestate homezip session ipaddress workaddress workcity workstate workzip etc... ) OR, is it better to partition the tabl...

Using a composite key in a many-to-many relationship in JPA

I've got the following situation: A User object has a Set of Permission objects (Set) Each User can have zero or more Permissions A Permission object has three fields The three fields of Permission up make up the composite key for that permission. As a consequence of this, we want exactly one instance in the DB of each Permission. ...

When would you define an index with a descending order?

Looking through a few SQL implementations, I noticed that most DBMSs support defining an index on a column with a descinding order, e.g. CREATE INDEX anIndex ON aTable (aColumn DESC); When would this be advantageous over an ASC index? Why is ASC or DESC part of the index definition? If the implementation of an index is efficient (B-t...

Storing images in DB vs in Folder Structure

I understand it is possible to store images in Databases as Binary large objects. But I used to see in some forum web applications that they are stored as flat files in web server machine and retrieved when needed. What is the advantage and disadvantage in both methods? When to go for which approach? ...

Java ORM related question - SQL Vs Google DB (Big Table?) GAE

I was wondering about the following two options when one is not using SQL tables but ORM based DBs (Example - when you are using GAE) Would the second option be less efficient? Requirement: There is an object. The object has a collection of similar items. I need to store this object. Example, say the object is a tree and it has a co...

What's a good approach for allowing users to define their own custom types?

Say you’re designing an application that, by requirement, allows a user the flexibility of creating custom types (for managing his data, whatever it may be). One way of handling this is to define a schema which allows us to use metadata for defining these types. This often means the resulting db schema will have some way of storing key...

Learning material for working with book databases?

I'm tasked with developing an application for retrieving, storing and searching data about books, magazines and the like, something very similar to a library application. While researching the topic I was stunned with the magnitude of different standards and acronyms, ISBNs, EANs, IANs and many more... so, are there any books or articles...