database-design

Designing a MongoDB solution?

I'm a RDBMS guy that has a project that I believe will work really well in a MongoDB system. For different reasons that I think is irrelevant for the questions at hand. Anyway, my system will be something like the following: Properties Available Houses House A 123 Pine Street House B 456 Main Street Realtors ...

Best pattern for storing (product) attributes in SQL Server

We are starting a new project where we need to store product and many product attributes in a database. The technology stack is MS SQL 2008 and Entity Framework 4.0 / LINQ for data access. The products (and Products Table) are pretty straightforward (a SKU, manufacturer, price, etc..). However there are also many attributes to store w...

best way to store 1:1 user relationships in relational database

What is the best way to store user relationships, e.g. friendships, that must be bidirectional (you're my friend, thus I'm your friend) in a rel. database, e.g. MYSql? I can think of two ways: Everytime a user friends another user, I'd add two rows to a database, row A consisting of the user id of the innitiating user followed by the...

friendship database schema

I'm creating a db schema that involves users that can be friends, and I was wondering what the best way to model the ability for these friends to have friendships. Should it be its own table that simply has two columns that each represent a user? Thanks! ...

database splitting; multiple tables

I am coding a classifieds ad web app. What is the optimal way to structure the database for this? Because of the high repeatability, would it be faster (in terms of searching/indexing) to have a separate table in the database for each city? Or would it be okay to just have one table for every city (it would have a lot of rows..). Th...

Are there performance problems in querying non varbinary(max) fields in a table containing varbinary(max) data?

I created a table to insert all the documents of my application. It is a simple table (let's call it DOC_DATA) that has 3 fields: DOC_ID, FileSize, Data. Data is varbinary(max). I then have many tables (CUSTOMERS_DOCUMENTS, EMPLOYEES_DOCUMENTS, ...) that contain other data (like "document description", "Created by", "Customer ID" ...). ...

How can I multi-org a single-org relational database?

I currently have a db that contains suppliers for our organization. These suppliers can supply us with a variety of commodities (equipment, supplies, services, etc.). Just recently, our organization decided to expand this database to cover our other locations across the country. Now the db must account for a supplier that can supply t...

How would I implement separate databases for reading and writing operations?

I am interested in implementing an architecture that has two databases one for read operations and the other for writes. I have never implemented something like this and have always built single database, highly normalised systems so I am not quite sure where to begin. I have a few parts to this question. 1. What would be a good resourc...

Questions and considerations to ask client for designing a database

Hi guys! so as title says, I would like to hear your advices what are the most important questions to consider and ask end-users before designing database for their application. We are to make database-oriented app, with special attenion to pay on db security (access control, encryption, integrity, backups)... Database will also keep s...

What are the downsides of a text-based primary index

I am working on a website and I want to make pretty urls. The urls are for certain extensions I am going to make. For example I want to have a url like this: http://www.mydomain.com/extensions/tester http://www.mydomain.com/extensions/worker http://www.mydomain.com/extensions/this-is-a-really-long-ext-name So the tester, worker, etc ar...

Related boolean columns -- separate columns or bitpacked into an integer column?

Hello I have a database for a certain record where it needs to store a 1 or a 0 for each day of the week. So which one would be better? Bitshifting each bit into an integer and just having an integer in the database named days or should we make all of them separate boolean values so to have sunday, monday, tuesday... columns? Note that ...

Process for beginning a Ruby on Rails project

I'm about to begin a Ruby on Rails project and I'd love to hear how others go through the process of starting an application design. I have quite a bit of experience with RoR, but don't have that many starting from scratch with only a vision experiences and would appreciate the wisdom of others who've been there. I'm looking for an orde...

how do simple SQLAlchemy relationships work?

I'm no database expert -- I just know the basics, really. I've picked up SQLAlchemy for a small project, and I'm using the declarative base configuration rather than the "normal" way. This way seems a lot simpler. However, while setting up my database schema, I realized I don't understand some database relationship concepts. If I had a...

Alternative design for a synonyms table?

I am working on an app which is to suggest alternative words/phrases for input text. I have doubts about what might be a good design for the synonyms table. Design considerations: number of synonyms is variable, i.e. football has one synonym (soccer), but in particular has two (particularly, specifically) if football is a synonym to s...

ArrayList of primitive types in Hibernate

I have a question regarding an ArrayList of Integers, or primitive types in general. Suppose I'm designing a POS program and each product may have several prices. Let's assume I can represent a price value with ints and in the Product class I have the field ArrayList<Integer> prices. What's the best way to map this with Hibernate? I co...

Suggestions for opening the Rails toolbox to design a challenge game?

How would you suggest designing a challenge system as part of a food-eating game so that it's automated as possible? All RoR tools, design patterns and logic are at your disposal (e.g., admin consoles, crontab, arch, etc.). Prize goes to whoever can suggest the simplest and most-automated design! Here are the requirements: User has ma...

I want define tables from ER Diagram.

I have a unary relationship. (Image Url : http://freezpic.com/pics/666c94955212a2f757fa25f9f7d31a5e.png) But I want define a table for person. The table has personID and personName column. What columns add it? ...

Database normalization question

Hi all, I am trying to make a fashion boutique site. In this site each product (t-shirt,jeans etc) belongs to a collection. Each collection has looks (t-shirt,jean,accessories). A product can belong to one collection and to multiple looks. How should I design the database? ...

Database Design: Why do some ecommerce database have separate tables for products and product_variants?

Hi Why do some ecommerce database have tables: product product_variant Why not only one product table with all teh fields of product_variant and is_default_product(bool) field? Thanks ...

(Database Design) why in the database tables most of the times primery key name is: <tablename_id> and not <id>?

Hi, why in the database tables most of the times primery key name is: tablename_id and not id? example: user_id and not just id. Thanks ...