Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Related Hot Network Questions. Question feed. Yes, there are some real life scenarios when you need that. An example? Here it is. Imagine a banking system that takes care of credit cards, their limits etc. There is a table with each credit card and its monthly limit:.
In this case NULL means infinity. Now, I need to write a query that gets me cards with the highest monthly limit. The first thought is to use the following query:. Obviously, the result is not correct. The fourth card has the highest limit infinity but it was wrongly returned last. Would you like to learn Liquibase? Find out! Today, in the first post of the SQL patterns series, we will consider the match by null pattern. It's inevitable that some data in the database has no value.
Find out what then with MySQL. However, NULLs should be handled with care — see how! Subscribe to our newsletter Join our monthly newsletter to be notified about the latest posts. Email address. The reason we used a sequence of two letter zee i. Since under normal circumstances there may not be a case where a word starts with two letter zees appearing consecutively, the above query works well for the particular case. However, if there is an instance where a word may start with two or more letter zee appearing consecutively, then the highest possible sequence of the letter zee can be used.
0コメント