Browser Market Share, February 2013

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

Google Chrome: 37.42% (+0.33%)
IE: 30.39% (-0.51%)
Firefox: 25.95% (-0.23%)
Safari: 3.50% (+0.51%)
Opera: 1.11% (-0.12%)

More »

Surrogate Key In Database Design

In database design, it is a good practice to have a primary key for each table. There are two ways to specify a primary key: The first is to use part of the data as the primary key. For example, a table that includes information on employees may use Social Security Number as the primary key. This type of key is called a natural key. The second is to use a new field with artificially-generated values whose sole purpose is to be used as a primary key. This is called a surrogate key.

A surrogate key has the following characteristics:

More »

Browser Market Share, January 2013

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

Google Chrome: 37.09% (-0.71%)
IE: 30.90% (+1.18%)
Firefox: 26.18% (-0.19%)
Safari: 2.99% (-0.08%)
Opera: 1.23% (-0.18%)

More »

Composite Key In SQL

Composite key, or composite primary key, refers to cases where more than one column is used to specify the primary key of a table. In such cases, all foreign keys will also need to include all the columns in the composite key. Note that the columns that make up a composite key can be of different data types.

Below is the SQL syntax for specifying a composite key:

More »

Ravens vs 49ers, Super Bowl 2013 Prediction

The matchup for Super Bowl XLVII (47) has been set: San Francisco 49ers vs Baltimore Ravens.

The 49ers were the NFC West Champion and was the #2 seed in the NFC. They reached the Super Bowl by first beating the Green Bay Packers, 45-31, where quarterback Colin Kaepernick ran wild and set a playoff rushing record for quarterbacks. In the NFC Championship Game, the 49ers went to Atlanta and was able to overcome Atlanta’s strong passing game in the first half to win, 28-24.

More »

Browser Market Share, December 2012

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

Google Chrome: 37.80% (+0.58%)
IE: 29.72% (-0.13%)
Firefox: 26.37% (-0.74%)
Safari: 3.07% (+0.21%)
Opera: 1.41% (-0.03%)

More »

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


More »

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.

More »