database

Changing IDs and updating tables.

We are trying to bring two different databases together but both databases are using the same IDs. Different info but we would have two users with same ID. Is there a way that we can change the IDs in one database and then update each of the tables using that ID? ...

Oracle (Old?) Joins - A tool/script for conversion?

I have been porting oracle selects, and I have been running across a lot of queries like so: SELECT e.last_name, d.department_name FROM employees e, departments d WHERE e.department_id(+) = d.department_id; ...and: SELECT last_name, d.department_id FROM employees e, departments d WHERE e.department_i...

Compare DB row values efficiently

I want to loop through a database of documents and calculate a pairwise comparison score. A simplistic, naive method would nest a loop within another loop. This would result in the program comparing documents twice and also comparing each document to itself. Is there a name for the algorithm for doing this task efficiently? Is there ...

In mysql or postgres, is there a limit to the size of an IN (1,2,n) statement?

I've got quite a few SQL statements like such: SELECT foo FROM things WHERE user_id IN (1,2,3..n) Is there a known limit to the number of elements that will safely fit in an IN clause like that? ...

Change an NSSet of NSNumber into an NSSet of int

Hi everyone, I'm using the data with core data and get an NSSet of NSNumber... my question is how can I do to change easily all the objects into int values? or can I directly get the int values from the database? Thanks ...

Legacy Database, Fluent NHibernate, and Testing my mappings

As the post title implies, I have a legacy database (not sure if that matters), I'm using Fluent NHibernate and I'm attempting to test my mappings using the Fluent NHibernate PersistenceSpecification class. My question is really a process one, I want to test these when I build locally in Visual Studio using the built in Unit Testing f...

MySQL Lookup table and id/keys

Hoping someone can shed some light on this: Do lookup tables need their own ID? For example, say I have: Table users: user_id, username Table categories: category_id, category_name Table users_categories: user_id, category_id Would each row in "users_categories" need an additional ID field? What would the primary key of said table...

Can a query be used in place of a table in SQL Server

This should really be allowed - I do not understand why it is not. SELECT * FROM ( SELECT * FROM MyTable ) ...

Sorting NSSets of a core data entity - Objective-c

Hi everyone, I would like to sort the data of a core data NSSet (I know we can do it only with arrays but let me explain...). I have an entity user who has a relationship to-many with the entity recipe. A recipe has the attributes name and id. I would like to get the data such that: NSArray *id = [[user.recipes valueForKey:@"identity"] ...

what are the difference between InnoDB and MyISAM.

what are the difference between InnoDB and MyISAM. Which one I can go for? any areas where one provides and other doesnot provide? IS there any technological limitations in any of the both types? Please help me to choose the right type for my project? ...

Display formatted text in a window using python

I make a program in wxpython which displays questions to the user and a radiobox with answers. Questions and answers should be in a database and is formatted text using some mathematics (paranthesis, root squares etc). Could you propose me what widget I should use for such a text and what could be the database? Thanks. ...

SQL Server: compare columns in two tables.

Hi, I've recently done a migration from a really old version of some application to the current version and i faced some problems while migrating databases. I need a query that could help me to compare columns in two tables. I mean not the data in rows, I need to compare the columns itself to figure out, what changes in table structure ...

Can't change data type on MS Access 2007

Hi All, I have a huge database (800MB) which consists of a field called 'Date Last Modified' at the moment this field is entered as a text data type but need to change it to a Date/Time field to carry out some queries. I have another exact same database but with only 35MB of data inside it and when I change the data type it works fine,...

SELECT only a certain set of rows at a time

I need to select data from one table and insert it into another table. Currently the SQL looks something like this: INSERT INTO A (x, y, z) SELECT x, y, z FROM B b WHERE ... However, the SELECT is huge, resulting in over 2 millions rows and we think it is taking up too much memory. Informix, the db in this case, runs out o...

What's the best way to put a database-driven app on Codeplex?

I'm primarily an ASP.NET developer and I'm hoping to move a few projects to Codeplex and open them up to the community. Most of my applications are database-driven, so I'm faced with the question of how I should deal with the database. Should I post the schema and expect contributors to build/host their own database? Should I include a d...

SchemaSpy for SQL Server using nightly build

I would like to automate SchemaSpy as part of a nightly build against a SQL Server database. I am unsure exactly how to go about this as there seems to be java sql server drivers missing when I go to generate. Could anyone give me a step by step run through of how to run schemaspy in this context please? ...

How to create a view and update it later?

Is it possible to update the same view with new data? Using UPDATE after CREATE didn't seem to work. Have only 1 table. Want the view to be a subset of that table. After using the view, I would like the same view to hold a different subset of the data from the only table. Was thinking I can create the view, drop it, then create it ...

What is wrong with this database query?

I have the following tables in a database (i'll only list the important attributes): Person(ssn,countryofbirth) Parents(ssn,fatherbirthcountry) Employment(ssn, companyID) Company(companyID, name) My task is this: given fatherbirthcountry as input, output the names of companies where persons work whose countryofbirth match the fatherbi...

Migrating to Oracle

We are using a JEE application and we are right now using Informix DB.Our code hits the DB with queries like "select first 10 * from test" Now as far as I know Oracle does not support 'first 10 *' kind of statements.We have more than 1000 queries like this.Should we manually change this or can have some manual customization? ...

Why does an empty database take megabytes of space?

When experimenting with (embedded) Apache Derby DB, I noticed that a fresh database, with no tables in it, takes about 1.7 MB of disk space. It's quite a bit more than my common wisdom would expect. Why is that? Are there significant differences in this between various database engines? Can this be controlled with some "block size" -lik...