database

Moving data between identical database schema's in MySQL

I have 2 databases with identical schemas. One is a master database serving production/marketing purposes (probably 95% SELECTs) and the other is a "slave" and runs SELECTs/INSERTs for orders, customers, etc for a specific micro-site. The reason for the separation is not all micro-sites will run the same products/specials/coupons etc an...

MySQL: Rewriting this subquery?

I am trying to build a new table such that the values in the existing table are NOT contained (but obviously the following checks for contained) in another table. Following is my table structure: mysql> explain t1; +-----------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default...

Keeping volatile objects in sync with a local database across processes

The Problem: I have a local database (sqlite in this case) with each record representing an object instance of a particular class. For this example lets say I have a class called Product. In this case this is in the Android environment but I'm curious about standard Java as well. When an application or activity starts I read all the da...

Simple SQL Problem

Hey...I am in a bind here. I am not much of a programmer but the guy who does the sql at my business is out sick. If I have a table like this (I am simplifying this a lot but this is where I am stuck). Name Object Payment Joe A 100 Jan A 200 Joe A 300 Ron A 500 Jan A 100 Joe B ...

Visual Studio 2010 automated Database deployment

In Visual Studio 2010 there is a nice feature of the database project that allows you to deploy to a database as well as set up various environments based on your configuration (Build deploy etc) I Would like to integrate this into our automated build environment. Firstly by having the deploy script run after a successful build on my l...

Does adding a unique constraint slow down things?

I have three columns in my table. +-----------+-----------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-----------------------+------+-----+---------+-------+ | hash | mediumint(8) unsigned | NO | PRI | 0 | | | nums | int(10) unsi...

database for huge files like audio and video

My application creates a large number of files, each up to 100MB. Currently we store these files in the file system which works pretty well. But I am wondering if there is a better solution to store the files in a some kind of file database. The simple advantage with database is if it can split the file and store in small chunks instead ...

Is it possible to create an Android database without external tools?

I have been searching for this for the past few days and every tutorial I see needs for me to use an external package. Is there anything built into the Android SDK that would allow me to create a database? I thought I saw something on it a long time ago, but I can't find anything to back that foggy memory up. ...

What are the benefits of using database cursor?

It is based on the interview question that I faced. Very short definition can be It can be used to manipulate the rows returned by a query. Besides the use of the cursor (Points are listed here on MSDN), I have a question in my mind that if we can perform all the operations using query or stored procedure (if I'm not wrong, Like...

Modelling non-relational database in Embarcadero

Is there a way to model a non-relational database (cobol-based) in Embarcadero? I need to use one as source system. ...

C# Spam Filter suggestions

Hi, Any idea (example) of spam filter implementation in C#? I would like to use a database to store unwanted words, to train my spam filter. Thanks. ...

How to detect MySql server failure?

If for any reason MySql server goes down, What are the ways I could still show my page to user? Probably having a backup DB server would help? If I've multiple DB servers and one goes down, I can fetch data from another temporary server? How to detect that main server is down? Who would select alternate server? role of reverse proxy s...

SQL Server transactions - whole db locked ?

Hi, I have a problem on specific SQL Server 2008 customer installation. I wrote the code below to simulate the problem which happens in more complex system. There are two connections (each one with own transaction) opened and each connection modifies a table. Modified tables do not relate to each other. On development platform and other ...

Database: when to split into separate tables?

Say if I have two different types of sensors: one monitors analog voltage (such as on a temperature sensor) and one measures whether something is on or off (switch sensor). I can't decide whether to have one table: [Sensor] Id : PK UpperLimit : FLOAT UpperLimitAlertDelay : INT LowerLimit : FLOAT LowerLimitAlertDelay : INT IsAnalog : BO...

Finding missing tables to avoid cross joins

Hi, the user in my application can choose freely some fields from the database. people + peopleid + peoplename cars + carid + carnumber + carcolor pers_car + carid + peopleid Lets assume the user is selecting the fields peoplename and carcolor to find out which person likes which colours. Is it possible to identify the missing per...

Backup/Restore MySQL ARCHIVE engine table - Can't find file

Hi, I recently did a backup of an MySQL ARCHIVE (engine) table and I am trying to restore this table on another server. Basically, the backup process was to copy the .ARZ and .frm and move the files on the new server. Then I chmoded the files (mysql:mysql) and set the permissions (now it appears 777 since I wanted to make sure it was no...

Tools for creating a "test" like environment on a development database

We have an Oracle Enterprise database in production and another instance that we use as both a QA and Development database. QA has requested that they be given separate schemas within the database so they can test applications isolated from changes made by developers. For an example, say the schema used in development and the one that ...

What fields should be indexed together? group by? order by?

I'm trying to speed up a query which I currently have as: SELECT * FROM `events` WHERE (field1 = 'some string' or field1 = 'some string') and is_current = true GROUP BY event_id ORDER BY pub_date this takes roughly 30seconds. field1 is a varchar(150) I'm currently indexing field1, is_current, event_id, pub_data charity, pu...

How to validate if there was 12 sequential payments

As example : I have this scenario where we receive payments, a singular payment per family, and register those payments with it's amount in the DB. The thing is that a family can move their loan from bank1 to bank2, only if they have 12 or more sequential payments. As example if they have registered a payment for oct, nov, dec, jan, ...

Berkeley DB with Perl API, can't open existing database

This is very perplexing, but I'm having this weird error. Here's the code I have: my $env = new BerkeleyDB::Env ( -Home => "$dbFolder", -Flags => DB_CREATE | DB_INIT_CDB | DB_INIT_MPOOL | DB_CDB_ALLDB ) or die "cannot open environment: $BerkeleyDB::Error\n"; my $unsortedHash = BerkeleyDB::Hash->new ( -Filename => "Uns...