database

Django -- How to filter objects with an "author" from a set of "authors"(users)?

How to filter objects with an "author" from a set of "authors"(Users)? The "objects" are Posts, having an author(ForeignKey to User). I'm pretty much stumped by this, so I'd appreciate help with it. Of course one could go about this the naive way, by manually filtering them, but that would hit the database real hard. Thanks anyway. E...

Why would I need to save IPs of my web site users?

Should I save this information in the database? For example when users sign up or log in? ...

database vs. flat files

The company I work for is trying to switch a product that uses flat file format to a database format. We're handling pretty big files of data (ie: 25GB/file) and they get updated really quick. We need to run queries that randomly access the data, as well as in a contiguous way. I am trying to convince them of the advantages of using a da...

"Should I use multiple indices in Solr?", and some other quick Q

Imagine a classifieds website, a very simple one where users don't have login details. I have this currently with MySql as a db. The db has several tables, because of the categories, but one main table for the classified itself. Total of 7 tables in my case. I want to use only Solr as a "db" because some people on SO thinks it would be...

Calculate Time Difference Between Two Rows SQL Server

I have a table that contains the following: DataDate Value 2010-03-01 08:31:32.000 100 2010-03-01 08:31:40.000 110 2010-03-01 08:31:42.000 95 2010-03-01 08:31:45.000 101 . . . . . . I need to multiply the value column by the difference in time bet...

Are there any good reference (open-source) Rails NoSQL apps?

I'm interested in seeing how using NoSQL would affect the architecture/design/code of a Rails application. Does anyone know of a good example of a open-source Rails app using NoSQL persistence? Thanks ...

How to properly index a table two other tables have a one-to-many relationship to?

Imagine I have three tables, called "customers", "companies" and "phone_numbers". Both customers and companies can have multiple phone numbers. What would be the best way to index phone_numbers? Have both customer_id and company_id and keep one of them null? What if there are more than two tables with a one-to-many relationship with phon...

Help with Database Design

I have four tables: ItemCategory, Items, DiamondCategoy and Diamonds. The users store item details and specify whether it has a diamond on, for example: ItemCategory: Ring Item: R1 If there is a diamond then: DiamondCategory: Round Diamond: D1 So R1 of Ring has D1 of Round An Item could have no diamonds, for example: ItemCategor...

Postgres Schema Issue

This is the default behavior for PostgreSQL is a search path like so: SHOW search_path; search_path -------------- "$user",public Is there a way to make it so the "$user" is case insensitive? For instance I have a user tp1, and a schema TP1... I'd like them both to be seen as "equal" Is this even possible? ...

Can ActiveRecord create tables outside of a migration?

I am working on a non Rails web app, so no migrations script by default. The Sequel ORM lets me create tables easily in a script: #!/usr/bin/env ruby require 'rubygems' require 'sequel' ## Connect to the database DB = Sequel.sqlite('./ex1.db') unless DB.table_exists? :posts DB.create_table :posts do primary_key :id varcha...

sql server 2008 database merging with another database

I have 2 sql server databases on two different remote servers. On day one, they were both exaclty the same. But over time, there are changes in both (different, tables, stored procs, views, etc..). How do I merge them together, so I have one again - the same Database in both places? ...

Copying data from one sqlite db to another

Hello, I have 2 sqlite DBs with common data but with different purposes and I wanted to avoid reinserting data, so I was wondering if it was possible to copy a hole table from one DB to another. I didn't find anything about this on google regarding sqlite DB's so my hopes are not hi. Thank you, ...

MYSQL: Private messaging system, large single table versus many small tables

I'm considering a design for a private messaging system and I need some input here, basically I have several questions regarding this. I've read most of the related questions and they've given me some thought already. All of the basic messaging systems I've thus far looked into use a single table for all of the users' messages. With ind...

Importing multiple records from sqlite db iphone sdk

I need some help! Please. I am trying to develop a very very simple application, basically just a simple book reader. Ideally, the first view would be a uitableview listing the names of chapters, then selecting the row would take you to a detail view that has the chapter which is broken up into segments. Note the segments are actually th...

Several operations inside of a single MongoDB query

Is it possible to alter more than one collection in a single query with MongoDB? A SQL example: begin update table_1 set some_field=1; update table_2 set a_different_field=2; commit ...

Connecting ASP.NET to MDF file

I finally got SQL Server Management Studio to work. I attached the Adventure Works sample database to it. Now I would like to display data from that database in ASP.NET. I would like to run SQL statements from ASP.NET. How do I do this? ...

Getting leaf nodes in an MDX query.

I'm trying to create an MDX query on the TFS cube which gets the historical values of the Estimate field. For each task I want to get the last estimate for each person who set the Estimate field. For example if Bob the project manager sets the estimate to 24 hours and then Dave the developer sets it to 32 hours, I want to create a quer...

How to use down()\rollback with database migration tools?

At my shop right now, we're trying to automate our deployment process. We're handling database migrations using a Rails-like migrations tool. One issue we're struggling with is how to automate rollbacks. For code, we can simply change the symlinked current version of the project to point to the old version (this is a web application, so ...

Designing tag system that can tag multiple db tables

Hi, I am wanting to allow users to tag items so that they can search for them using tags. What is the best way of achieving this cleanly? So far the solution I have come up with only involves adding two extra tables to my current db system. <db Trackable product 1> int id; info etc </> <db Trackable product 2> int id; info etc </> //...

Looking for a SQL-based RDBMS with a Windows GUI

I have an application I developed 20 years ago with INFORMIX-SQL version 2.10 for MS-DOS 5.0. I have it working on MS-DOS 6.22, within Microsoft Virtual PC 2007, under Windows Vista, but I would like to re-write this application with a WINDOWS-based RDBMS. I'm looking for a product, similar in functionality to informix-sql, but for wind...