database

sql help: how can I add quantities together?

Basically this code below returns the right information, but I need to add the quantities together to bring back one record. Is there any way of doing this? select category.category_name, (equipment.total_stock-equipment.stock_out) AS Current_Stock, equipment.stock_out from EQUIPMENT, CATEGORY WHERE EQUIPMENT.CATEGORY_ID = CATEGORY.CAT...

Is there a way to enable / disable constraints in db2 v7?

Hello people, I have to copy tables from an Oracle database to a db2 v7 one, and in order to do this (avoiding millions of drops and creates) I'd like to know if db2 has a feature like Oracle to enable / disable constraints temporarily without dropping them. Thanks in advance, Mauro. ...

What Are the Pros and Cons of Filemaker ??

A potential customer has asked me to look at some promotional flyers for a couple of apps which fall into the contact management / scheduler category. Both use Filemaker as their backend. It looks like these two apps are sold as web apps. At any rate I had not heard of Filemaker in about ten years, so it was surprising to see it pop u...

What is the best way to maintain a LastUpdatedDate column in SQL?

Suppose I have a database table that has a timedate column of the last time it was updated or inserted. Which would be preferable: Have a trigger update the field. Have the program that's doing the insertion/update set the field. The first option seems to be the easiest since I don't even have to recompile to do it, but that's not r...

Auto increment stopped in MySQL?

I'm working on a script that sadly I inherited - with no commenting or anything. Argh! For testing purposes I duplicated one of the tables in the database which had an auto-incrementing ID. When the data is saved to the database, though, the ID number just reads "0" -- which is the default for that column. I'm not sure why it's not auto...

DB table refactoring

Hi I'm using ms2005 for a simple calendaring system. We have three 'legacy' tables: Groups, Units and Staff. I need to give each record in the tables a unique identifier (carrying across all 3 tables). What would be best way to approach this? I am using NHibernate and was was wondering whether that could do it for me. Anyway, any nods...

How can I check for DBNull while executing my command only once?

When I retrieve any Scalar value from the database, I usually write code like this for nullable fields. cmd.ExecuteScalar() == DBNull.Value ? 0 : (int)cmd.ExecuteScalar() But I don't like it because it executes the Executescalar statement twice. It's an extra trip to the server for my website and in favor of performance I don't want t...

PostgreSQL replication strategies

Right now we are using PostgreSQL 8.3 (on Linux) as a database backend to our Ruby on Rails web application. Considering that on PostgreSQL database we actively use row level blocking and PL/PGSQL, what can we employ to secure our data -- I mean tools, packages, scripts, strategies -- to successfully replicate the database and build mul...

I want to start coding, where do I start?

I'm primarily a graphic designer but would like to develop skills in writing basic code. I'd like to create a little program or code that would allow me to do the following tasks. Sheet of events,dates and times etc is either typed or uploaded through excel to a database which then displays by date. As each event or task is completed a ...

How to use HTML in LifeRay ShoppingItem description?

How can I embed HTML into the ShoppingItem database table "description" field in such a way that it will display on screen? It used to work in older versions, but in the current version it mangles/safes it to display the HTML tags, rather than passing them through to be processed. Is there an alternate method to achieve the desired eff...

Oracle TNS names not showing when adding new connection to sqldeveloper

Hello, I'm trying to connect to an oracle database with sqldeveloper. I've installed the .Net oracle drivers and placed the tnsnames.ora file at C:\Oracle\product\11.1.0\client_1\Network\Admin. I'm using the following format in tnsnames.ora. dev = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XXX.XXX)(PORT = XXXX)...

Skip certain tables with mysqldump

Is there a way to restrict certain tables from the mysqldump command? For example, I'd use the following syntax to dump only table1 and table2: mysqldump -u username -p database table1 table2 > database.sql But is there a similar way to dump all the tables except table1 and table2? I haven't found anything in the mysqldump documentat...

SQL/Database Views in Grails

Does anybody know what is the best approach to accessing a sql view through Grails (or if this is even possible)? It seems an obvious way of doing this would be to use executeQuery against the view to select a collection of rows from the view which we would not treat as a list of domain objects. However, even in this case it is not obvio...

Providex Query Performace Problem

I am running a query against a providex database that we use in MAS 90. The query has three tables joined together, and has been slow but not unbearably, taking about 8 minutes per run. The query has a fair number of conditions in the where clause: I'm going to omit the select part of the query as its long and simple, just a list of fie...

Open source Database to ship with my application

Hi, I need open source database that I can ship with my commercial application. It should not have any installation (i.e., no window service and no setup). It can be single user database. It should work in Windows environment and used from Java code. Thanks ...

Can you use a object-database in a production system?

Object-databases are used very seldomly, albeit they offer a way to live without SQL, which is, I think, a benefit of its own. Yet, I have seen them about never in production systems. Is there something fundamentally wrong with object-databases? Can I use a object-database in a production system? Edit: So, maybe I should confess that ...

PostgreSQL - Correlated Sub-Query Fail?

I have a query like this: SELECT t1.id, (SELECT COUNT(t2.id) FROM t2 WHERE t2.id = t1.id ) as num_things FROM t1 WHERE num_things = 5; The goal is to get the id of all the elements that appear 5 times in the other table. However, I get this error: ERROR: column "num_things" does not exist SQL state: 42703 I'...

What is your favorite solution for managing database migrations in django?

I quite like Rails' database migration management system. It is not 100% perfect, but it does the trick. Django does not ship with such a database migration system (yet?) but there are a number of open source projects to do just that, such as django-evolution and south for example. So I am wondering, what database migration management...

Saving CheckBox control values

Hello everyone, I am using asp.net and I am trying to save checkbox values into a database. Multiple checkboxes may be entered into the same field in the database. So for instance I have two checkboxes with names "Comma" and "Hyphen" and if the user checks both of these then the database will store the values ',','-'. How do you do this...

Data structure or algorithm for second degree lookups in sub-linear time?

Is there any way to select a subset from a large set based on a property or predicate in less than O(n) time? For a simple example, say I have a large set of authors. Each author has a one-to-many relationship with a set of books, and a one-to-one relationship with a city of birth. Is there a way to efficiently do a query like "get all...