12,750 reputation
12049
bio website
location Munich
age
visits member for 3 years, 7 months
seen 1 hour ago

1d
comment How to Shift a column up in a ring buffer?
Which DBMS are you using? Postgres? Oracle?
1d
comment the <set clause>'s <multiple column assignment>
Yes, that's perfectly legal: sqlfiddle.com/#!15/711e9/1 This can also be used in e.g. a where clause: where (a,b,c) = (1,2,3)
1d
comment I can't divide 2 count(*) values without returning zero
Which DBMS are you using? Postgres? Oracle?
2d
comment Unique index on columns which are allowed to be NULL
Well, if it's not possible to have the same price at the same time, then you do want a unique index with an exclusion constraint as I mentioned. Did you go through the link from my second comment? As far as I can tell it is essentially the same thing as your question.
2d
comment Unique index on columns which are allowed to be NULL
@ErikVandeVen: that behaviour is the way this is specified in the SQL standard. Other DBMS (not all though) work the same way.
2d
comment Unique index on columns which are allowed to be NULL
Do you really allow two different prices in the same (from, to) interval? Say 42€ between 10:00 to 14:00 and 48€ between 11:00 to 13:00 (on the same day)? What is the price at 12:00 then? If you really allow that, this sounds like a terrible idea.
2d
comment How to call a windows program in mysql prompt in windows
I think with "that stands still" you actually mean "that still stands". "That stands still" means "it's not moving"...
2d
comment Unique index on columns which are allowed to be NULL
See here for example: dba.stackexchange.com/q/75034/1822
2d
comment Unique index on columns which are allowed to be NULL
What is the goal of that index? Only having a single offer per product? Then you don't need to include the price columns at all. Unless you can have different prices for the same product for the same period (which I doubt). You probably want an exclusion constraint on valid_from, valid_to for the same product_id
Dec
13
comment Which keyword i should use?
@miracle173: you are right. The join assumes that (a,c) is unique. Thanks for pointing that out.
Dec
13
comment Which keyword i should use?
My first example creates a table with only two columns because the select list only has two columns.
Dec
13
comment Change execution plan in Oracle
Edit your question and add the query, the index definitions, the tables (as create table) and the execution plan. All as formatted text please.
Dec
11
comment Translate psql meta-command to SQL
Start psql with the -E parameter . The manual will give you more details: postgresql.org/docs/current/static/app-psql.html
Dec
11
comment PostGIS 1.5 Error with PostgreSQL 8.4
Is there any reason you are using an outdated Postgres version?
Dec
9
comment MySQL: is there a way to make a self-referencing join recursive?
MySQL does not support recursive queries
Dec
9
comment How to determine if there are [idle connections with] uncommitted transactions in PostgreSQL?
state = 'idle' does not indicate an open transaction.
Dec
8
comment Slow max, min query in Postgresql View
That's only an explain but not an explain analyze.
Dec
8
comment How do I create a user-defined aggregate function in MySQL (redux)?
Btw: I don't really understand your requirement. There are only two scores for each student in your example data. If you "drop" them, nothing is left to calculate the average
Dec
8
comment How do I create a user-defined aggregate function in MySQL (redux)?
Is upgrading to Postgres an option? You can easily write aggregates in PL/pgSQL there. But for the problem at hand I think you wouldn't even need a custom aggregate. Some clever use of window functions will probably solve this.
Dec
7
comment What is the privilege my user requires to be able to grant CONNECT, RESOURCE and CREATE SESSION to other users in Oracle 11g?
connect and create session is the same thing. There is no need to grant both.