Re: Is anything ever equal to NULL?

2009-12-28 Thread Martijn Tonies
Well, if nothing can ever equal null, then why isn't MySQL query parser smart enough to reduce my queries to something more sensible? If I'm saying this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; Why isn't it able to reduce the query to something more lik

RE: anniversary selects

2009-12-28 Thread Noel Butler
Thanks, that's exactly what I was after. On Mon, 2009-12-28 at 14:53 -0800, Daevid Vincent wrote: > Perhaps the examples here would help you: > http://dev.mysql.com/doc/refman/5.0/en/date-calculations.html > > > -Original Message- > > From: Noel Butler [mailto:noel.but...@ausics.net]

Re: Is anything ever equal to NULL?

2009-12-28 Thread D. Dante Lorenso
Well, if nothing can ever equal null, then why isn't MySQL query parser smart enough to reduce my queries to something more sensible? If I'm saying this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; Why isn't it able to reduce the query to something more like t

Re: mysql load balancing

2009-12-28 Thread Baron Schwartz
Miguel, On Fri, Dec 25, 2009 at 4:56 PM, Miguel Angel Nieto wrote: >> Load balancing, or high availability? >> >> I do not think there is anything good and simple AND generic out of >> the box.  As previous posters have noted, you generally have to build >> something on top of other tools. > > Hi

RE: Weeks

2009-12-28 Thread Gavin Towey
See: http://gtowey.blogspot.com/2009/04/how-to-select-this-wednesday-or-other.html just calculate the two dates, and use WHERE order_date BETWEEN (calculated start date) AND (calculated end date) This avoids using functions on the actual column when possible, since that will prevent using index

Re: Is anything ever equal to NULL?

2009-12-28 Thread David Giragosian
On Mon, Dec 28, 2009 at 5:41 PM, Carsten Pedersen wrote: > David Giragosian skrev: > >> On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso >> wrote: >> >> Will anything ever be equal to NULL in a SELECT query? >>> >> > ... > > What's so special about NULL? >>> >> >> >> http://dev.mysql.com/doc/r

Weeks

2009-12-28 Thread ML
Hi All, trying to write some SQL that will give me records for the CURRENT WEEK. Example, starting on a Sunday and going through Saturday. This week it would be Dec 27 - Jan 2. I am doing this so I can write a query that will show orders that are placed during the current week. Here is what I

Re: Why does this query take so long?

2009-12-28 Thread René Fournier
I think you might be right. The good-to-poor performance I'm seeing is so intermittent. And I see now that it's also with other queries, though not as extremely obvious as the spatial queries. However, even if the Index can't fit in memory (4GB of RAM, lots free), just reading it from disk shoul

RE: anniversary selects

2009-12-28 Thread Daevid Vincent
Perhaps the examples here would help you: http://dev.mysql.com/doc/refman/5.0/en/date-calculations.html > -Original Message- > From: Noel Butler [mailto:noel.but...@ausics.net] > Sent: Saturday, December 26, 2009 6:47 PM > To: mysql@lists.mysql.com > Subject: anniversary selects > > Hi,

Re: Is anything ever equal to NULL?

2009-12-28 Thread Carsten Pedersen
David Giragosian skrev: On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso wrote: Will anything ever be equal to NULL in a SELECT query? ... What's so special about NULL? http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html Should answer some of your questions, Dante. Oddly e

Re: Is there a better way than this?

2009-12-28 Thread DaWiz
This will work: select distinct X from a as a where Y in(25) and not exists (select X from a as b where a.X = b.X and b.Y in(24)) - Original Message - From: "Tim Molter" To: Sent: Sunday, December 27, 2009 4:04 PM Subject: Is there a better way than this? I'm new to MySQL and I'm

RE: Why does this query take so long?

2009-12-28 Thread Gavin Towey
It sounds like your laptop might be paging mysql's memory to disk or something like that. Your laptop may not be the most reliable source for benchmarks. Regards, Gavin Towey -Original Message- From: René Fournier [mailto:m...@renefournier.com] Sent: Monday, December 28, 2009 2:16 AM To

Re: Is anything ever equal to NULL?

2009-12-28 Thread Martijn Tonies
Hi, Will anything ever be equal to NULL in a SELECT query? No, never. Null also means "unknown", if you design your tables well enough, there should be no NULLs -stored- (different from a resultset, where there can be nulls, for example in LEFT JOINs), because it's no use to store what you d

MySQL slave master replication

2009-12-28 Thread Jamie DelleMonache
I know the master/slave replication scheme for MySQL is pretty easy to set up; I'm doing it lab now. My question is does anyone know if it will successfully replicate foreign key constraints and large BLOB date types. Any feedback on this would be gratefully appreciated. __

RE: Is there a better way than this?

2009-12-28 Thread Gavin Towey
No, that won't work, remember that the WHERE clause is applied to each row individually -- y is 25, then it also cannot possibly be 24 at the same time, so AND condition has no meaning there. What you're asking for there is the set of all x that have 25 as a y value, which is 1 and 2. You need

Re: Is anything ever equal to NULL?

2009-12-28 Thread David Giragosian
On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso wrote: > > Will anything ever be equal to NULL in a SELECT query? > > SELECT * > FROM sometable > WHERE somecolumn = NULL; > > I have a real-life query like this: > > SELECT * > FROM sometable > WHERE somecolumn = NULL OR somecolumn = 'abc';

Re: Is anything ever equal to NULL?

2009-12-28 Thread Michael Dykman
No, nothing will ever equal null. In strict relational theory, which I don't know well enough to begin expounding on here, null does not even equal another null. That's why SQL provides IS NULL and IS NOT NULL as explicit cases. - michael dykman On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorens

Is anything ever equal to NULL?

2009-12-28 Thread D. Dante Lorenso
Will anything ever be equal to NULL in a SELECT query? SELECT * FROM sometable WHERE somecolumn = NULL; I have a real-life query like this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; The 'sometable' contains about 40 million records and in this query, i

Re: Is there a better way than this?

2009-12-28 Thread Michael Dykman
Gavin, very nice, - michael dykman On Mon, Dec 28, 2009 at 2:16 PM, Gavin Towey wrote: > No, that won't work, remember that the WHERE clause is applied to each row > individually -- y is 25, then it also cannot possibly be 24 at the same time, > so AND condition has no meaning there.  What y

Re: Database fundamentals: wanna learn.

2009-12-28 Thread Gary Smith
Ken D'Ambrosio wrote: Hey, all. I've been using databases clear back to xBase days; that being said, I've never had a solid foundation for relational databases. While I can muddle by in SQL, I really don't have a good understanding of exactly how keys are set up, the underpinnings of indexing,

Re: Database fundamentals: wanna learn.

2009-12-28 Thread Martijn Tonies
Hey, all. I've been using databases clear back to xBase days; that being said, I've never had a solid foundation for relational databases. While I can muddle by in SQL, I really don't have a good understanding of exactly how keys are set up, the underpinnings of indexing, and, oh, lots of gro

RE: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance

2009-12-28 Thread Jerry Schwartz
From: Edward S.P. Leong [mailto:edward...@ita.org.mo] Sent: Monday, December 28, 2009 9:25 AM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance Jerry Schwartz wrote: -Original Message- From: Edward S.P. Le

Re: Database fundamentals: wanna learn.

2009-12-28 Thread Mike OK
I have two of Paul's books. They are both fantastic. Mike O'Krongli President and CTO Acorg Inc 519 432-1185 - Original Message - From: "Claudio Nanni" To: "Ken D'Ambrosio" Cc: "mysql" Sent: Monday, December 28, 2009 10:33 AM Subject: Re: Database fundamentals: wanna learn. Hi K

Re: Database fundamentals: wanna learn.

2009-12-28 Thread Peter Brawley
Ken, So, any suggestions -- books, courses, web sites, what-have-you -- that I should be hitting up so I can have a better grasp of what's going on behind the scenes? http://dev.mysql.com/doc/refman/5.5/en/tutorial.html Start at top left and work your way downwards & rightwards at http://www

Re: Database fundamentals: wanna learn.

2009-12-28 Thread Claudio Nanni
Hi Ken, thanks for sharing! If you want to start from scratch, I would go for a book like this: http://www.amazon.com/SQL-Complete-Reference-James-Groff/dp/0071592555/ref=dp_ob_title_bk I did not 'read' it thru, but this is the one I would buy. If you want to embrace MySQL, in my opinion, the bes

Re: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance

2009-12-28 Thread Edward S.P. Leong
Jerry Schwartz wrote: >>-Original Message- >>From: Edward S.P. Leong [mailto:edward...@ita.org.mo] >>Sent: Thursday, December 17, 2009 7:25 AM >>To: mysql@lists.mysql.com >>Subject: 32bit ( php + mysql server ) on 64bit Windows 2003 Server >>performance >> >>Dear all, >> >>Would you mind

Database fundamentals: wanna learn.

2009-12-28 Thread Ken D'Ambrosio
Hey, all. I've been using databases clear back to xBase days; that being said, I've never had a solid foundation for relational databases. While I can muddle by in SQL, I really don't have a good understanding of exactly how keys are set up, the underpinnings of indexing, and, oh, lots of ground-

Re: Why does this query take so long?

2009-12-28 Thread René Fournier
Even weirder, I came back to my laptop a couple hours later. And now the same queries are taking 3-10 seconds instead of 0.01 seconds. What could be causing this? On 2009-12-28, at 1:19 PM, René Fournier wrote: > Hmm, weird. I just re-imported the data (after drop/create table, etc.), and > no

Re: Is there a better way than this?

2009-12-28 Thread Tim Molter
Thanks for the replies! Chris, yeah, that's the first thing I tried. The problem though is that SQL statement also returns Row #2 (x=1, y=25) since y=25 is associated with both x=1 and x=2. I want it only to return row #3. As John said, it may not be possible with a simple SQL statement. My tabl