database

How to select maximum 3 items per users in MySQL?

Hi, I run a website where users can post items (e.g. pictures). The items are stored in a MySQL database. I want to query for the last ten posted items BUT with the constraint of a maximum of 3 items can come from any single user. What is the best way of doing it? My preferred solution is a constraint that is put on the SQL query re...

Best way to show default values for empty fields returned from a database query?

Is there a better way to write this code? I want to show a default value ('No data') for any empty fields returned by the query: $archivalie_id = $_GET['archivalie_id']; $query = "SELECT a.*, ip.description AS internal_project, o.description AS origin, to_char(ad.or...

How should I stress test / load test a client server application?

Hi all I develop a client-server style, database based system and I need to devise a way to stress / load test the system. Customers inevitably want to know such things as: • How many clients can a server support? • How many concurrent searches can a server support? • How much data can we store in the database? • Etc. Key to all thes...

Best practice for handling null strings from database (in Java)

In my database application I sometimes have to deal with null strings in the database. In most cases this is fine, but when it comes do displaying data in a form the Swing components - using JTextField for example - cannot handle null strings. (.setText(null) fails) (EDIT: I just noticed that JTextField actually accepts a null string, b...

Database Engine Independant Data Modelling

I'm looking for a tool where I maintain a simple data model, and then using possibly plugins, generate actual databases for MSSQL and mySQL, and as a bonus, others. This should not be a whole ORM tool, just abstract to concrete data model. Where should I look? Who knows of one? ...

Application data synchronisation - running the new app in tandem with the legacy

We're in the process of replacing a legacy system. There is going to be a period of time with both the applications running in tandem. Users will be able to use either system and the challenge is to be able to keep their databases in sync with each other. The new system is ASP.NET and the legacy is VB6. Both are running on a SQL Serv...

Java O/R layer for SQL server?

I've got a java server (not web based, more like a big, many-threaded standalone application) that needs to talk to a MS SQL Server database. I just worked on a different project that ported a home-grown O/R layer from oracle to SQL Server, and it ran into significant problems because of too many oracle assumptions (locking, mostly). S...

Best Practice for seeing live data on the dev server?

Assumption: live/production web app suppresses errors being shown to end-users. Suppose your tech support team wants to see live data but through the eyes of the development-side of the application (maybe you want to see what errors are occurring, or want to see when you've got an issue fixed using an end-user's data). Right now we've ...

What is a good Visio Enterprise Architect replacement?

I've been using Visio 2002/2003 Enterprise Architect to do my database schema design visually and then forward-generate the DDL to create the database. I wanted to switch to Visio 2007, but while it does have database diagramming support, it doesn't have the ability to generate DDL. Bummer. I am really disappointed because it seems li...

Programmically pull data types for MS SQL table columns for later insertion

Rails has an awesome way of looking up column names and expected datatypes from the DB, alleviating a lot of programming. I'm trying to build something like this in C#.NET, because we have large tables that are ever changing. I'll be adding parameters like so: SqlParameter param = new SqlParameter("parametername", *SqlDbType.Int*); par...

How do you debug MySQL stored procedures?

My current process for debugging stored procedures is very simple. I create a table called "debug" where I insert variable values from the stored procedure as it runs. This allows me to see the value of any variable at a given point in the script, but is there a better way to debug MySQL stored procedures? ...

Database change underneath SQLObject

I'm starting a web project that likely should be fine with SQLite. I have SQLObject on top of it, but thinking long term here -- if this project should require a more robust (e.g. able to handle high traffic), I will need to have a transition plan ready. My questions: How easy is it to transition from one DB (SQLite) to another (MySQ...

Delphi: "Invalid field type" error with master/detail datasets

I asked about setting up an in-memory dataset with TClientDataset, and was told I had to use the "Create Data Set" command in the form designer. That works just fine until I try to create a master-detail database relation. If I have a field def of type ftDataSet, then running the Create Data Set command (or calling the method at runtim...

Preventing Duplicate Inserts Into SQL With PHP

I'm going to running thousands of queries into SQL and I need to prevent the duplication of field 'domain'. Never had to do this before and any help would be appreciated. ...

Design pattern for memcached data caching

It's easy to wrap optional memcached caching around your existing database queries. For example: Old (DB-only): function getX x = get from db return x end New (DB with memcache): function getX x = get from memcache if found return x endif x = get from db set x in memcache return x end The th...

MySql: MyISAM vs. Inno DB!

What are the differences between MyISAM and Inno DB types in MySql? ...

How do function indexes work in SQL?

Does anyone know how function indexes work in databases? ...

Have you tinkered with Rel?

I would like to hear opinions or peoples experiences regarding Rel. Is it destined for the dustbin, or is it the next big thing in programming? I haven't tried doing anything with it yet (and it looks like you really can't at this point), but I'm intrigued by a few of the concepts discussed in it. Notably: Removal of nulls completel...

Which tools or methods would you suggest for creating large amounts of SQL test data?

I'd like to stress test some of my SQL queries and find out about bad query plans and bottlenecks. I plan to fill some tables with random test data. Are there tools or a set of scripts available for this purpose, preferably for SQL Server? Thanks! UPDATE: Sorry, didn't know these two question already existed: Data generators for SQL...

What are the best ways to understand an unfamiliar database?

What kind of approaches and techniques can you employ to become familiar with an existing database if you are tasked with supporting and/or modifying it? How can you easily and effectively ramp up your knowledge of a database you have never seen before? ...