database

Advanced database concepts

I have agreed to become a teacher's assistant in a database course and have also been asked to look into changes that can be made to the course. The course is called "Advanced Databases", but its name is a bit deceptive. The students are not computer science majors but some kind of "IT management"-students and thus lack much of the unde...

Storing database data in files?

I'm currently working on a school project, in java, and I'm coding a database application. Something like the MySQL Monitor where you type in queries and get results / whatever. In applications I've coded before, I used databases to store data, like user profiles, settings, etc. Now, obviously, I can't use a database to store data gener...

How to deploy complex SQL solutions through an installer?

Part of the setup routine for the product I'm working on installs a database update utility. The utility checks the current version of the users database and (if necessary) executes a series of SQL statements that upgrade the database to the current version. Two key features of this routine: Once initiated, it runs without user intera...

Can Multiple Indexes Work Together?

Suppose I have a database table with two fields, "foo" and "bar". Neither of them are unique, but each of them are indexed. However, rather than being indexed together, they each have a separate index. Now suppose I perform a query such as SELECT * FROM sometable WHERE foo='hello' AND bar='world'; My table a huge number of rows for w...

Database independence in Unix/C

We have a system written in C and running under Solaris & Linux that uses the Sybase CT-library to access a Sybase database. We generate the table-definitions, indexes, stored procedures and C-code from an in-house developed DDL to reduce the amount of work and errors. We would like to achieve database independence, so we can add (as a ...

SQL clone record with a unique index

Is there a clean way of cloning a record in SQL that has an index(auto increment). I want to clone all the fields except the index. I currently have to enumerate every field, and use that in an insert select, and I would rather not explicitly list all of the fields, as they may change over time. ...

How to design a fact table for delivery data

I'm building a data warehouse that includes delivery information for restaurants. The data is stored in SQL Server 2005 and is then put into a SQL Server Analysis Services 2005 cube. The Deliveries information consists of the following tables: FactDeliveres BranchKey DeliveryDateKey ProductKey InvoiceNumber (DD: degenerate dimension)...

mysql "drop database" takes time -- why?

mysql5.0 with a pair of databases "A" and "B", both with large innodb tables. "drop database A;" freezes database "B" for a couple minutes. Nothing is using "A" at that point, so why is this such an intensive operation? Bonus points: Given that we use "A", upload data into "B", and then switch to using "B", how can we do this faster? Dr...

How can I extract the address information from a Compressed ESRI shapefile datasource?

When I download the zip file from the website it contains files with the following extensions: .dbf .prj .sbn .sbx .shp .shp.xml .shx Is this is a common data file format that I download or purchase a converter? I think this is some kind of mapping data file but I all need are the addresses it contains to push into our existing databas...

Selecting unique rows in a set of two possibilities

The problem itself is simple, but I can't figure out a solution that does it in one query, and here's my "abstraction" of the problem to allow for a simpler explanation: I will let my original explenation stand, but here's a set of sample data and the result i expect: Ok, so here's some sample data, i separated pairs by a blank line -...

Stratagies for Data Loading and DB Initialization for Integration Tests

I'm developing an integration testing framework for a data intensive J2EE enterprise application and I'm trying to decide upon a strategy for initializing and populating the database. We have a fairly complex model. The system will have to: Initialize the system itself Load users Load application test data The test data won't be a...

pl/sql dollar operator?

I encountered the following ddl in a pl/sql script this morning: create index genuser.idx$$_0bdd0011 ... My initial thought was that the index name was generated by a tool...but I'm also not a pl/sql superstar so I could very well be incorrect. Does the double dollar sign have any special significance in this statement? ...

Does anyone use GoogleData?

I was recently considering using GoogleData for a hobby project to store my service's old data, (say 24+hours old), while I keep the fresh data on my servers (hobby project==cheap home server). However I haven't really heard of anyone using GoogleData, so I was wondering about what other's experiences have been. Edit: My brief usage pa...

Custom Sorting of a DataSet Column

I have a DataSet that contains a few columns. One of these columns is a number - most of the time. Because it's occasionally a string, in the database it's a varchar(10) column. However, when you sort a varchar column, it sorts it like a string. What I want to do instead is to try and override this somehow so that it sorts the integers ...

Sqlite update field if it contains

Given a database field named "widget_ids", containing data like "67/797/124/" or "45/", where the numbers are slash separated widget_ids... how would you make an update statement with SQL that would say: "if the widget_ids of the row with id X contains the text "somenumber/" do nothing, otherwise append "somenumber/" to it's current valu...

Search for information on building large enterprise systems.

How do you organize DB layer, business logic and cross-platform API of your information management system, if uploading and processing 500000 data records in one session is a normal operation (C# .NET 3.5 + MS SQL 2005)? I’m specifically interested in production-proven paging patterns that behave well with the concurrency, scalability a...

Best way to make double insert

What's the best way of inserting information in table A and using the index from table A to relate to table B. The "solution" I tried is inserting the info in table A (which has a automatically generated ID), then, select the last index and insert it in table B. This may not be very useful, as the last index may change between the ins...

Do you put your indexes in source control?

And how do you keep them in synch between test and production environments? When it comes to indexes on database tables, my philosophy is that they are an integral part of writing any code that queries the database. You can't introduce new queries or change a query without analyzing the impact to the indexes. So I do my best to keep m...

C++ SQL Database program (Yes it is for school!)

I have the following code that I wrote but it the SQLBindCol does not seem to work correctly (of course I could have screwed up the whole program too!.) THe connection works, it creates the table in the DB, addes the record fine and they all look good in SQL Enterprise Manager. So what I need help with is after the comment "Part 3 & 4:...

How should I store a Guid in Oracle

I am coming from the SQL server world where we had uniqueidentifier. Is there an equivalent in oracle? This column will be frequently queried so performance is the key. I am generating the GUID in .Net and will be passing it to Oracle. For a couple reasons it cannot be generated by oracle so I cannot use sequence. ...