This tag specifies that the question is independent of any particular database and the sql should work in any rdbms.
Questions tagged [database-agnostic]
100 questions
3
votes
3 answers
How to create portable inserts from SQL Server?
Now it generates inserts like
INSERT [Bla] ([id], [description], [name], [version])
VALUES (CAST(1 AS Numeric(19, 0)), convert(t...
It's very SQL Server specific. I would like to create a script that everybody can use, database agnostic. I have…

IAdapter
- 62,595
- 73
- 179
- 242
3
votes
3 answers
How to group the records according to the range in SQL
Hi I would like to create a SQL to group the records according to the range
For example, suppose I have
Number Time Price
100 20100810 10.0
100 20100812 15.0
160 20100810 10.0
200 20100810 …

skydoor
- 25,218
- 52
- 147
- 201
3
votes
4 answers
SELECT DISTINCT on a field not appearing in recordset?
I want to do a SELECT DISTINCT guid, ..., but I don't want guid appearing in the recordset. How do I do this?

user151841
- 17,377
- 29
- 109
- 171
3
votes
1 answer
CakePHP Multiple Nested Joins
I have an App in which several of the models are linked by hasMany/belongsTo associations. So for instance, A hasMany B, B hasMany C, C hasMany D, and D hasMany E. Also, E belongs to D, D belongs to C, C belongs to B, and B belongs to A. Using…
user35288
3
votes
4 answers
Is it possible to search for dates as strings in a database-agnostic way?
I have a Ruby on Rails application with a PostgreSQL database; several tables have created_at and updated_at timestamp attributes. When displayed, those dates are formatted in the user's locale; for example, the timestamp 2009-10-15 16:30:00.435…

Alpha Hydrae
- 2,891
- 6
- 26
- 24
3
votes
3 answers
Agnostic Connection Handlers in .NET
I'm developing a simple database acessor for a system, but i need to support 2 databases, PostgreSQL and Oracle (XXg);
A example would be like this (already working for pgsql)
... bunch of properties, constructors and fields
private String…

George Silva
- 3,454
- 10
- 39
- 64
3
votes
2 answers
Database design for tags and URL
I'm building simple application for myself in JSP which stores URL for me and finds it based on tags. For which i want to design a database. I'm limited with my knowledge of SQL. But still i want to learn by doing.
I want to create database that…

Stark
- 183
- 5
- 13
3
votes
6 answers
Primary Keys - Native, Sequence, or GUID keys?
In reading this and this and then reading this (which references the other two ironically) I find myself wondering just how big the discussion of this topic is? I am a SQL Server guy and so I tend to use an Identity that is auto generated in the…

Andrew Siemer
- 10,166
- 3
- 41
- 61
2
votes
3 answers
SQL : built-in way to detect gaps in a arbitrary series of dates?
I have a set of tables that feed into a historical reports. It's taking a while to generate the report now, and I want to create cache tables that will store the compiled data that then feed into the report.
One key of these cache tables will be a…

user151841
- 17,377
- 29
- 109
- 171
2
votes
4 answers
Database Agnostic Application
The database for one the application that I am working on is not confirmed yet by the business.
Best guess is Oracle and DB2.
What I've heard is initially the project will go live with DB2 V9 and then to Oracle 11g.
We are using Spring 3.0.5,…

adi
- 1,711
- 3
- 29
- 50
2
votes
4 answers
Put all exclusion conditions in sql query or first get all results and then perform exclusion code in memory?
In my query I want to get all users of the same city. This query will also be available to end users so that they can see other users of same city.
I query user table so it retrieves all the users even who has ran the query.
Now there are 2 options…

codecool
- 5,886
- 4
- 29
- 40
2
votes
2 answers
Why is NULL handled differently in aggregate and scalar functions?
Let's take the following two queries:
select greatest(1, val) from unnest([null]) as val
# null
And:
select sum(val) from unnest([1, null]) as val
# 1
My question is why is null handled differently between aggregate functions and normal scalar…

David542
- 104,438
- 178
- 489
- 842
2
votes
1 answer
Database agnostic stored procedure API
Our legacy web application heavily uses stored procedures. We have a central interface through which all database calls (i.e. queries and procedures) are made. However, the current implementation uses the OracleCommandBuilder.DeriveParameters method…

Matthew Rodatus
- 1,393
- 9
- 18
2
votes
4 answers
Index on a table you must fully scan anyway? (MySQL)
I'm pretty stumped here.
I have 2 tables and I'm left joining the first (around 500k records) with the second (around 2.2 million records) in order to find out which records are in the first and not the second. (typical "b.attribute is null"…

Brian Rosamilia
- 1,448
- 14
- 24
2
votes
1 answer
jOOQ: Database-agnostic way of disabling constraints
I'd like to know if there's a way to disable database constraints in jOOQ for different databases in an agnostic way. For example, disabling foreign key constraints in MySQL and PostgreSQL differs quite a lot:
MySQL
SET…

Gian Paolo Buffo
- 381
- 4
- 19