JortK.nl
Mind farts of a crappy coder!
  • Home
  • Fok!Search
  • Fok! Maandcijfers

query

11 MySQL resources you must read!

By JortK on February 9, 2010

Conditional joins in MySQL
One way to do a “Conditional Join” in MySQL is by using a “LEFT JOIN”.  Create a “LEFT JOIN” for each condition and combine the results into one column using an “IF” statement by the “SELECT” expression
Monitoring your MySQL errors
Great tutorial on how to monitor your MySQL Server for errors.
New OLAP Wikistat [...]

Posted in MySQL | Tagged benchmark, cast, error, join, monitor, MySQL, query, tutorial | 1 Response

The 20 best practices when using MySQL

By JortK on November 28, 2009

Just came across this great article with 20 best practices when using MySQL: MySQL best practices.
Be sure to check them, the following items are in the article:

Optimize Your Queries For the Query Cache
LIMIT 1 When Getting a Unique Row
Get Suggestions with PROCEDURE ANALYSE()
Prepared Statements
Split the Big DELETE or INSERT Queries
Be Careful with Persistent Connections

And more [...]

Posted in MySQL | Tagged best practices, cache, database, db, MySQL, query, select, show | Leave a response

Using TOP in Oracle queries

By JortK on June 30, 2009

We already discussed the methods to use TOP functions in MySQL and in MSSQL.
In Oracle we make use of the ROWNUM function in the WHERE clause.
To take our names table again in this example, to get the first 5 rows, make use of the following query:

SELECT firstname,lastname
FROM names
WHERE ROWNUM <= 5

This will retrieve the first [...]

Posted in How to | Tagged database, limit, oracle, query, top, trick | Leave a response

Using TOP in MS-SQL queries

By JortK on June 27, 2009

After I explained the MySQL method for getting the TOP N rows in a query it is time to explain the same for MS-SQL.
Here we use the TOP function.
To retrieve the first 5 rows from the names table, use the following query:

SELECT TOP 5 firstname,lastname
FROM names

If you want to retrieve a certain percentage (for example [...]

Posted in How to | Tagged limit, ms-sql, mssql, query, sql, top, trcik | Leave a response

Using TOP in MySQL queries

By JortK on June 26, 2009

On the web I see a lot of questions of developers who are wanting to know how they can retrieve only the first N records in their queries.
The answer is simple, LIMIT
For example, if you only want to select the top 5 names from a names tables, use the following query:

SELECT `firstname`,`lastname`
FROM `names`
ORDER [...]

Posted in How to | Tagged database, db, limit, MySQL, query, rownum, top, trick | Leave a response

EXISTS much faster then IN in MySQL

By JortK on July 23, 2008

Today I was making some queries on a database with a lot of records.
The table I was making the query on had 25.000.000 records.
The performance of the query I’ve made was terrible, the structure was as follows (fake column names used):

SELECT * FROM t_posts
WHERE id IN
(SELECT id
FROM t_topics
WHERE id BETWEEN 150000 AND 150001)

This query took [...]

Posted in MySQL | Tagged exists, in, MySQL, performance, query | 6 Responses

Categories

  • google
  • How to
  • microsoft
  • Movies
  • Music
  • MySQL
  • php
  • Pictures
  • RSS Reader Picks
  • seo
  • Site News
  • Tech news
  • twitter
  • Uncategorized
  • wordpress

Tags

ad ads adsense analytics android api apps blog browser buzz chrome dance development docs funny gmail google hardstyle hiphop house jquery labs mail maps marketing mobile movie Music MySQL os php rap rss search seo social tip tutorial twitter video wave web development webinar wordpress youtube

Archives

  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • April 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008

Copyright © 2010 JortK.nl.

Powered by WordPress, Hybrid, and Structure.