Questions tagged [database-agnostic]

This tag specifies that the question is independent of any particular database and the sql should work in any rdbms.

100 questions
2
votes
1 answer

Slick generic AND driver agnostic

Basically what I want to achieve is a combination of: Slick 3.0.0 database agnostism and Slick 3 reusable generic repository I tried a lot, actually, but I can't get this to work at all. abstract class BaseModel[T <:…
user4063815
2
votes
4 answers

Database independence

We are in the early stages of design of a big business application that will have multiple modules. One of the requirements is that the application should be database independent, it should support SQL Server, Oracle, MySQL and DB2. From what I have…
2
votes
6 answers

Getting week number of date in SQL

Is there a way to get the week number of a date with SQL that is database independent? For example to get the month of a date I use: SELECT EXTRACT(MONTH FROM :DATE) But the EXTRACT function doesn't know about weeks in SQL92. Please pay attention…
radlan
  • 2,393
  • 4
  • 33
  • 53
2
votes
2 answers

Magento installer setup agnostic insert

I got through this tutorial regarding Magento Setup Resources. At some point I saw that it supports more database backends, but in the mentioned tutorial is described only the way you can create tables. I would need some resources/examples regarding…
Michael
  • 4,786
  • 11
  • 45
  • 68
2
votes
2 answers

SQL: Group by on value1 and "not" value1?

I have a table with something like the following: OrderNo, OrderType 1, Type1 2, Type1 3, Type2 4, Type3 5, Type4 Doing a "group by" on OrderType is easy but is there a way to do a "group by" to get something like: OrderCount, OrderType 2, Type1 3,…
Matt
  • 2,503
  • 4
  • 31
  • 46
2
votes
5 answers

How do I normalise this database design?

I am creating a rowing reporting and statistics system for a client where I have a structure at the moment similar to the following: ----------------------------------------------------------------------------- | ID | Team | Coaches | Rowers …
Ian Roke
  • 1,774
  • 1
  • 19
  • 27
2
votes
1 answer

Relational vs NoSql: Which database should I use for this kind of app?

I am about to build an application which does analytics on student results. Ghe data that needs to be stored looks like this: Course: name Semester: 1st,2nd etc Student: name Subject1: marks Subject2: marks Subject3: marks Subject4: marks Subject5:…
CuriousMind
  • 33,537
  • 28
  • 98
  • 137
2
votes
2 answers

optimize query with column in where clause

I have an sql query which fetch the first N rows in a table which is designed as a low-level queue. select top N * from my_table where status = 0 order by date asc The intention behind this query is as follows: First, this question is intended to…
Yoni
  • 10,171
  • 9
  • 55
  • 72
1
vote
2 answers

Open sql connection in business service

Do you see it as tight coupling that my business service class opens a SqlConnection ? Actually a business service should not be aware of the concrete dataprovider?! public class UnitService: public void DeleteUnit(Unit unit) { …
Pascal
  • 12,265
  • 25
  • 103
  • 195
1
vote
2 answers

Rails: Making this query database-agnostic...?

I have these two lines in my model, written for PostgreSQL: named_scope :by_month, lambda { |month| { :conditions => ["EXTRACT(MONTH FROM recorded_on) = ?", month] }} named_scope :by_year, lambda { |year| { :conditions => ["EXTRACT(YEAR FROM…
neezer
  • 19,720
  • 33
  • 121
  • 220
1
vote
5 answers

Database agnostic SQL for returning list for Date of birth stored as a Timestamp

If I need to search on Date of birth which is stored without the hours and minutes but the date I have to search with includes hours and minutes what is the best way to return all rows where date is matched on only day, month and year i.e. Stored…
Craig Angus
  • 22,784
  • 18
  • 55
  • 63
1
vote
6 answers

Can there be a database-agnostic SQL query to fetch top N rows?

We want to be able to select top N rows using a SQL Query. The target database could be Oracle or MySQL. Is there an elegant approach to this? (Needless to say, we're dealing with sorted data here.)
pugmarx
  • 7,323
  • 3
  • 30
  • 40
1
vote
1 answer

SQL 4-valued logic table

What are the truth tables for the proposed 4-value logic in SQL that has both an A-value null and an I-value null? From here. Using AND for this, 3VL looks like this: How would the following table look?
David542
  • 104,438
  • 178
  • 489
  • 842
1
vote
5 answers

how to allow your code to store undetermined number of columns?

I think my question might be unclear , but i would try to explain it by example . say that we had about 100 different car model , clearly all of the car would share common parts or specification but not all parts are shared between all of these 100…
tawfekov
  • 5,084
  • 3
  • 28
  • 51
1
vote
8 answers

Appropriate query and indexes for a logging table in SQL

Assume a table named 'log', there are huge records in it. The application usually retrieves data by simple SQL: SELECT * FROM log WHERE logLevel=2 AND (creationData BETWEEN ? AND ?) logLevel and creationData have indexes, but the number of…
卢声远 Shengyuan Lu
  • 31,208
  • 22
  • 85
  • 130