Have you considered if B is.

 
Makino: Varieur: ok, seems odd though

Varieur: MikeJoel: even INT UNSIGNED has more than enough.

Varieur: MikeJoel: no. It’s perfectly normal, if you understand the purpose of a primary key.

Sibley: Varieur: currently using mediumint

Grave: Xgc, can I make just one more newbie stupid question? I promised it will be the very last one for today

Gier: Xgc, I know you will say this depends on my case, but can I find out if a given query+schema is “too slow for my needs”?

Zebley: Say, what would be some targets that I can set for my system performance?

Cobell: For instance, in the context that I will be running +1k queries per second, should queries that take over 2 seconds to complete be considered as slow?

Havard: I know ppl measure this in terms of page latency or response latency, but at this point I dont have a working setup to test latency but maybe I can make estimations, extrapolations from my query response times

Tyrrell: Is there a way to simulate Sequences in Mysql ?

Clemence: NM, found something: https://www.percona.com/blog/2008/04/02/stored-function-to-generate-sequences/

Longford: Can I turn foreign keys columns into Nullable ?

Hayer: ArtisanIndia, should be possible, “nothing” becomes valid reference

Kickel: I want to use multiple condition in where clause

Voong: E.g where id=88 and date 2015 or some_date 2016

Seabright: Both the date and some_date are one single where clause

Forys: ArtisanIndia, and is there any problem?

Almstead: Where id=88 and date2015 or some_date2016

Kordowski: Yes i am getting all the records

Pych: ArtisanIndia, what type is date/some_date? date/datetime or int, varchar?

Banik: A number 30 is greater than NULL?

Blomgren: A negative number is also greater than NULL?

Dambrozio: It’s undefined, i.e. null

Darty: Suppose I have SELECT s1 FROM t1 WHERE s1 ALL SELECT s1 FROM t2;

Larson: Subquery returns 12,6,NULL,-100

Bory: And outer query returns 30

Berton: Is s1 greater than the values of the subquery?

Stopa: Note that there is a NULL in the values of subquery

Schrock: Net2014, your example is directly from the manual and it is covered there when you mix two cases : “The expression is unknown that is, NULL if table t2 contains 0,NULL,1” – covers your case with 30

Balderston: I have a table, with A et B column. I am making an INSERT INTO SELECT query . Most of the time A & B are a unique couple, but sometimes there can be duplicate

Manker: But I want to accept duplicates in only one case

Fallow: When the value of B is 0

Lindabury: Afaik INSERT IGNORE won’t do it since I will allow all duplicates

Garavaglia: I’ve tried ON DUPLICATE with IFB=0, C=-1, SIGNAL .

Kothenbeutel: And it’s not a good Vasko 😀

Conception: Yes, I update the C field

Koppa: The C column it does not really matter, I just wanted to know how much lines are duplicated but if you have a solution that does not allow this update, I’ll take it :

Hormann: Hm, two queries, one insert select where b != 0 with either ignore or other means to remove duplicates and second one with where b=0 and on duplicate key update

Canslor: Insert ignore does not “allow” duplicates, it ignores them actually instead of error it only skips the row insertion and shows a warning

Lutao: By allow I meant “do not stop the query” :

Blau: The two queries thing will do the job

Mcmikle: So simple, damn morning 😀

Pospicil: From what i’m reading you want a unique contraint but don’t want a unique contraint. – answer – make up your mind, only one of these conditions is possible.

Moench: Have you considered if B is NULL is acceptable? in this case is A unique?