Rename Table in SQL

Sometimes, it may be necessary to rename a table. There is no standard way to rename a table, and the implementation varies by RDBMS. Below we discuss how we can rename a table in MySQL, Oracle, and SQL Server.


In MySQL, we can rename a table using one of the following methods:

Method 1


Method 2


Continue reading

Find 2nd Largest Value Using SQL

We all know that the MAX function can be used to find the largest value in SQL. How, then, can we write a single-pass SQL that can be used across different database systems to find the second largest value in a column? Single-pass means only one SQL query gets executed, as opposed to having multiple SQL statements using temporary tables to store intermediate results.

Continue reading

Dockster – New Mac Malware Found

A new malware targeting Mac computers have been found and is given the name Dockster. Dockster is a backdoor malware that allows the attacker to compromise the victim’s computer by logging keystrokes and downloading files. It infects computers in the same way as the Flashback malware, which was first discovered in September, 2011. This particular exploit was due to a vulnerability in Java, which Apple had issued a patch for in April, 2012. Systems that have not been patched, however, are still vulnerable to this malware.

Continue reading

Browser Market Share, November 2012 and IE’s Browser Your Love To Hate Campaign

Here is the browser market share for November 2012, based on traffic to my top site (number in parentheses shows change from October 2012):

Google Chrome: 37.22% (+0.51%)
IE: 29.85% (-0.92%)
Firefox: 27.11% (+0.01%)
Safari: 2.86% (+0.32%)
Opera: 1.44% (+0.08%)

Continue reading