Posts Tagged ‘queries’

Mysql-Querying By Date

Thursday, July 24th, 2008

We are so frequently required to create date based queries, eg how many orders last week, last month, how many orders between two dates. It is necessary to avoid the trap of treating date as a number, instead convert the date into a handy unit such as days

# select all records from today
select * from tbl_orders where TO_DAYS(NOW()) = TO_DAYS(dtmdevdate);

# select all records from last three days
select * from tbl_orders where (TO_DAYS(NOW())-3) > TO_DAYS(orderdate);

MySQL provides a whole range of date functions become familiar with them here

Mysql-Test your MySQL queries inside a MySQL GUI before coding them

Thursday, July 24th, 2008

Before you start coding your application with PHP or whatever remember to test out your MySQL in your MySQL GUI such as SQLYOG or even the CLI

What are the advantages?

* You don’t have to worry about the Script/MySQL syntax clashes (quoting etc)
* You only have to think MySQL and not say PHP as well
* You can see the data produced or not produced
* You can test your concepts

Search Engine Optimization-Searching by Means of Search Engines

Tuesday, July 15th, 2008

This is where things start to get complicated.
Search engines are trickier than they look!  You’ll discover this the first time you enter a query on C++, the programming language.  At least of the Web search engines will essentially say, “Huh?”

C++ is not a word.  It’s a letter followed by two characters that might, depending on the index, be regarded merely as punctuation.  Many text search engines have trouble handling input of this type.  Many don’t deal too well with numbers, either.  So much for “007,” “R2D2,”or “Catch-22.”

Important Note:  This problem is no longer as bad as it used to be.  I’m now finding relevant hits for C++ on a majority of search engines sites.

Here’s another example of a text string search engines hate:  To be or not to be.  Just about anyone who finished junior high school will be able to tell you where the phrase comes from and (possibly!) what it means.  But some search engines choke because all the words in the phrase are stop words–i.e., unimportant words too short and too common to be considered relevant strings on which to search.   However, if you enclose the query in quotation marks, forcing the search engine to find the words, “to be or not to be” in that precise order, most search engines can  recognize the phrase as a famous quotation from Hamlet.

Let’s take a less obvious example.  Suppose you’re a fan of murder mysteries and you want to search the Web for the home pages of all your favorite authors in that genre.  If you simply enter the words “mystery” and “writer,” most search engines will return hyperlinks to all Web documents that contain the word “mystery” or the word, “writer.”  This will probably include hundreds–or even thousands–of URLs, most of which will have no relevance to your search. If you enter the words as a phrase, however, you stand a better chance of getting some good hits.

However, as search technology advances, this is not as much of a problem as it was a couple of years ago. Many search engines will now automatically apply the “adjacency” operator when responding to a two-word query. This means that they will indeed look for documents in which your two words appear next to each other.

If you understand how search engines organize information and run queries, you can maximize your chances of getting hits on URLs that matter.

Extended Googling

Tuesday, July 15th, 2008

Google offers several services that give you a head start in focusing your search. Google Groups (http://groups.google.com) indexes literally millions of messages from decades of discussion on Usenet. Google even helps you with your shopping via two tools: Froogle (http://froogle.google.com), which indexes products from online stores, and Google Catalogs (http://catalogs.google.com), which features products from more 6,000 paper catalogs in a searchable index. And this only scratches the surface. You can get a complete list of Google’s tools and services at www.google.com/options/index.html.

You’re probably used to using Google in your browser. But have you ever thought of using Google outside your browser?

Google Alert (www.googlealert.com) monitors your search terms and e-mails you information about new additions to Google’s Web index. (Google Alert is not affiliated with Google; it uses Google’s Web services API to perform its searches.) If you’re more interested in news stories than general Web content, check out the beta version of Google News Alerts (www.google.com/newsalerts). This service (which is affiliated with Google) will monitor up to 50 news queries per e-mail address and send you information about news stories that match your query. (Hint: Use the intitle: and source: syntax elements with Google News to limit the number of alerts you get.)

Google on the telephone? Yup. This service is brought to you by the folks at Google Labs (http://labs.google.com), a place for experimental Google ideas and features (which may come and go, so what’s there at this writing might not be there when you decide to check it out). With Google Voice Search (http://labs1.google.com/gvs.html), you dial the Voice Search phone number, speak your keywords, and then click on the indicated link. Every time you say a new search term, the results page will refresh with your new query (you must have JavaScript enabled for this to work). Remember, this service is still in an experimental phase, so don’t expect 100 percent success.

In 2002, Google released the Google API (application programming interface), a way for programmers to access Google’s search engine results without violating the Google Terms of Service. A lot of people have created useful (and occasionally not-so-useful but interesting) applications not available from Google itself, such as Google Alert. For many applications, you’ll need an API key, which is available free from www.google.com/apis.

Thanks to its many different search properties, Google goes far beyond a regular search engine. Give the tricks in this article a try. You’ll be amazed at how many different ways Google can improve your Internet searching.

PPC Basics

Thursday, June 26th, 2008

PPC advertising (Pay Per Click) is similar to search engine optimization in that it revolves around targeting consumers based on the search queries they are using to find products and services through search engines. Despite that, pay per click advertising is much different because it involves paying for each click you receive to your website rather than attempting to manipulate editorial results. Pay per click advertising is much more complex than it may appear to be based on your initial understanding; not only do you need the expertise and tools to develop a list of thousands of keywords, you also have to understand the processes involved in ensuring you both measure they effectiveness of your PPC advertising and also pay the least amount per click that you have to.

When contacting a PPC or internet marketing company to enquire about their services, you should initially look for a provider who appears to understand both your business model and the complications and challenges that surround PPC advertising. A great indicator of the likely skill of a provider is to speak to a past customer of theirs and find out if they are happy with the results they have attained from working with the company and if they would be happy to recommend them to you.

What kind of search engines people are using?

Thursday, June 26th, 2008

Be prepared to be amazed! And the winner for French Canadian Search Engine is…. Google with 80%, followed by Yahoo 3.6% and MSN with 2.5%. That’s mainly due to the fact that there are not that many Multilanguage search engines. The US market on the other hand is a bit more diverse as it has few more search engines but still Google has about 44%, Yahoo with 28.7% and MSN with 12.5% of the total search queries which is still not bad.