database-design

Sql Server Development Server and Live

I have a database project that goes through iterations (only one so far) and I need to deploy a testing version to a live server. I'm not sure how to go about this. I can make all the changes in a copy and then remake those changes in the live version. That doesn't make sense. Is there a way to change a server name to an existing ser...

top-k selection/merge

I have n sorted lists (5 < n < 300). These lists are quite long (300000+ tuples). Selecting the top k of the individual lists is of course trivial - they are right at the head of the lists. Example for k = 2: top2 (L1: [ 'a': 10, 'b': 4, 'c':3 ]) = ['a':10 'b':4] top2 (L2: [ 'c': 5, 'b': 2, 'a':0 ]) = ['c':5 'b':2] Where it gets mor...

Describing the Relationship for Each Combination of Objects (Language-Agnostic)

I need to describe a two-combination of objects. I am trying to describe reciprocal relationships for these objects based on a list of criteria. Think of it this way: I have, say, 3 football players: Andy, Ben, and Charles. For each combination, they are compared with a list of criteria: physical, tactical, skill. The comparison is simpl...

Best naming for a column in a SQL Server table

Which of the following three options would you choose for a column name in a SQL Server table, and why? YearToDateWages YTDWages YtdWages Follow up: SSN Ssn SocialSecurityNumber ...

Using hashing to group similar records

I work for a fulfillment company and we have to pack and ship many orders from our warehouse to customers. To improve efficiency we would like to group identical orders and pack these in the most optimum way. By identical I mean having the same number of order lines containing the same SKUs and same order quantities. To achieve this I w...

Database design with blobs - keep in separate tables?

I have a situation where I need to store binary data in an Oracle database as blob columns. There are three different tables in my database wherein I need to store a blob data for each record. Not every record will necessarily have the blob data all the time. It is dependent on time and user. Table One will store *.doc files for almost...

How to represent a 3-way relation with JPA?

A user may have several labels, and links. Then, a user associates a label (or more) to a link. How does one represent the later relationship? A solution could be a many-to-many relationship btw user and link with the optional attribute label. http://en.wikibooks.org/wiki/Java_Persistence/ManyToMany#Mapping_a_Join_Table_with_Additional_...

how do I integrate the aspnet_users table (asp.net membership) into my existing database

i have a database that already has a users table COLUMNS: userID - int loginName - string First - string Last - string i just installed the asp.net membership table. Right now all of my tables are joined into my users table foreign keyed into the "userId" field How do i integrate asp.net_users table into my schema? here are the i...

ERD Design help meeded

Hello guyz, I am new to ERD and stuff.Earlier i was drawing an erd that issued me some problems. the name of two entities in focus is "Bus" and "Passenger".What shall be the relationship between them. I think it should be many to many since one passenger can travel in many buses and a bus can give ride to many passengers.But on...

How to handle product ratings in a database

Hello, I would like to know what is the best approach to storing product ratings in a database. I have in mind the following two (simplified, and assuming a MySQL db) scenarios: Scenario 1: Create two columns in the product table to store number of votes and the sum of all votes. Use columns to get an average on the product display pag...

Mongodb vs. Cassandra

I am evaluating what might be the best migration option. Currently, i am on a sharded mysql (horizontal partition), with most of my data stored in json blobs. I do not have any complex SQL queries( already migrated away after since I partitioned my db) Right now, it seems like both Mongodb and Cassandra would be likely options. My situ...

Ecommerce database design looking for good book

Hi I looking for good book about E-commerce database design. Thanks ...

Database design: OR relation

I have a database with a "users" table containing data about my users. Each user is to be linked to a company or a college. I wish to have two separate tables "college" and "company" each with a field "ID". So how do I link each record in the users table to either a company or a college? The basic thing is that I wish to establish an "...

can we have a foreign key which is not a primary key in any other table?

it is written in every book that foreign keys are actually primary key in some other table but can we have a foreign key which is not primary key in any other table ...

how to model a follower stream in appengine?

I am trying to design tables to buildout a follower relationship. Say I have a stream of 140char records that have user, hashtag and other text. Users follow other users, and can also follow hashtags. I am outlining the way I've designed this below, but there are two limitaions in my design. I was wondering if others had smarter ways...

Data Warehouse: One Database or many?

At my new company, they keep all data associated with the data warehouse, including import, staging, audit, dimension and fact tables, together in the same physical database. I've been a database developer for a number of years now and this consolidation of function and form seems counter to everything I know. It seems to make securi...

Why use SQL database?

I'm not quite sure stackoverflow is a place for such a general question, but let's give it a try. Being exposed to the need of storing application data somewhere, I've always used MySQL or sqlite, just because it's always done like that. As it seems like the whole world is using these databases (most of all software products, frameworks...

which is better, creating a materialized view or a new table?

I have some demanding mysql queries that have to select same frequently updated datasets from 5-7 mysql tables. 'Select' operation would be a bit more than CUD. I am thinking of creating a table or materialized view to gather all demanding columns from other tables, so as to reduce overall query times to different tables and thus incre...

Database design (MySql)::should we put html data in text field inside database table or more efficient to save inside text.txt file?

Hi, We building big Web Application and we use mysql, we want to make mysql database more fast. Some of us think if we will put message html body inside table and not inside text.txt in will make database heavy and not fast. Thanks, *Part of main table that hold message: option 1:hold html message body inside database message { id (int...

(database design,mysql) Is my database design good for basic shopping cart?(I new in database design)

Hi, I new in database design, I want to be sure that i make it well. Please take a look for part of my database design: My database design for basic shopping cart: //table that holds shopping cart items that customer choose(not press checkout and order //them) **shopping_cart** { id (int) product_id (int) fk product_quantity (int) cus...