database

What is an example of a non-relational database? Where/how are they used?

I have been working with relational databases for sometime, but it only recently occurred to me that there must be other types of databases that are non-relational. What are some examples of non-relational databases, and where/how are they used in the real world? Why would you choose to use a non-relational database over relational dat...

Unit tests framework for databases

I´m looking for a unit tests framework for database development. I´m currently developing for SQL Server 2000, 2005 and 2008. Do you know of any good frameworks with similar functionality as JUnit and NUnit? Perhaps it´s better to ask, what do you use to unit test your stored procedures and user defined functions? ...

Find leaf nodes in hierarchical tree

I have a table in my database which stores a tree structure. Here are the relevant fields: mytree (id, parentid, otherfields...) I want to find all the leaf nodes (that is, any record whose id is not another record's parentid) I've tried this: SELECT * FROM mytree WHERE `id` NOT IN (SELECT DISTINCT `parentid` FROM `mytree`) But th...

How do you write a case insensitive query for both mySQL and postgres?

I'm running a mySQL database locally for development, but deploying to Heroku which uses postgres. Heroku handles almost everything, except that my case insensitive Like statements become case sensitive. I know I could use iLike statements, but my local mySQL database can't handle that. What is the best way to write a case insensitive q...

How to use enums in Oracle?

How do you use enums in Oracle using SQL only? (No PSQL) In MySQL you can do: CREATE TABLE sizes ( name ENUM('small', 'medium', 'large') ); What would be a similar way to do this in Oracle? ...

Database design for database-agnostic applications

What do I have to consider in database design for a new application which should be able to support the most common relational database systems (SQL Server, MySQL, Oracle, PostgreSQL ...)? Is it even worth the effort? What are the pitfalls? ...

Application Architecture - How would you design this process

I have an application that is made up of the following: A central database containing 100k+ records A number of "client" databases each containing around 10-20k records The client databases contain details of contacts that each have a unique ID (contactID). The central database contains some of these contacts identified by the same con...

Why does running a script from SQLPlus not require a password?

I noticed its possible to run SQL scripts with Oracle's SQLPlus by providing only a username and no password. Isn't this like a horrible breach of any form of security for Oracle? Or am I missing something? ...

Best practice to realize a long-term history-mode for a O/RM system(Hibernate)?

I have mapped several java classes like Customer, Assessment, Rating, ... to a database with Hibernate. Now i am thinking about a history-mode for all changes to the persistent data. The application is a web application. In case of deleting (or editing) data another user should have the possibility to see the changes and undo it. Since ...

What is the syntax for inserting data into a timestamp(6) type field in Oracle

I need to insert some data into a table in Oracle. The only problem is one of the fields is a timestamp(6) type and it is required data. I don't care about what actually goes in here I just need to get the right syntax for an entry so that the database will accept it. I'm using the gui web client to enter data however I don't mind usi...

Does field size affect query time?

My question is in regards to MySQL, but I also wonder how this affects other databases. I have several fields that are varchar(255) but my coworker insists if they were varchar(30) -- or any smaller size -- then queries would run faster. I'm not so sure, but if it's so I'll admit to it. :) Thanks. ...

How do I initialize a blank database as per a populated dataset?

Initialization would include creating all the required tables, constraints and populating the tables. edit: Is there already a project doing this? ...

TSD3004 error with Visual Studio 2008 Database Project

I am using Visual Studio Team System 2008, version 9.0.30729.1 SP. I have a database project that I was working with yesterday with no issues - I was able to build and deploy the database successfully. Today, however, when I open the solution I receive what is listed as a "Warning" that halts any Build/Deploy/etc process, but cannot be s...

which db should i select if performance of postgres is low

In a web app that support more than 5000 users, postgres is becoming the bottle neck. It takes more than 1 minute to add a new user.(even after optimizations and on Win 2k3) So, as a design issue, which other DB's might be better? ...

Database for ENORMOUS amounts of data?

Here, my boss, is asking me and the people at the office which Database engine could be the best for a very very huge amount of data. We have been discussing a while in the office and no conclusion came... But as I think that this is a pretty interesting question for discussing ...

How to convert a SqlServer DateTime to universal time using SQL

I have a database with DateTime fields that are currently stored in local time. An upcoming project will require all these dates to be converted to universal time. Rather than writing a c# app to convert these times to universal time, I'd rather use available sqlserver/sql features to accurately convert these dates to universal time so...

SQL Subquery

I have SQL data that looks like this events id name capacity 1 Cooking 10 2 Swimming 20 3 Archery 15 registrants id name 1 Jimmy 2 Billy 3 Sally registrant_event registrant_id event_id 1 3 2 3 3 2 I would like to select all of the fields in 'ev...

Visio database diagrams, associating columns

Hi there, I'm trying to be a good developer and create some documentation before I start programming my next project. I have created a database schema diagram in Visio and created relationships between columns. However, I am looking for a way to make the relationships between columns more clear. I want the arrow to connect column to ...

You Log to Your DB, Where Do You Log When Your DB is Down?

I'm working with logging in PHP with Pear, and I get into a standard problem: can I use file-based logging when the DB is not available? I don't mind if it's slow due to concurrency issues, but it cannot fail to work due to multiple, simultaneous hits. I'm asking this question in general (for other web technologies) and specifically fo...

Well explained algorithms for indexing and searching in metric spaces

I need to implement some kind of metric space search in Postgres(*) (PL or PL/Python). So, I'm looking for good sources (or papers) with a very clear and crisp explanation of the machinery behind these ideas, in such way that I can implement it myself. I would prefer clarity over efficiency. (*) The need for that is described better he...