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:
RENAME OLD_TABLE_NAME TO NEW_TABLE_NAME
ALTER TABLE OLD_TABLE_NAME
RENAME TO NEW_TABLE_NAME
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.
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.
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%)
On November 28, Amazon announced it is entering the data warehousing field by announcing the Amazon Redshift service. Amazon Redshift is build on the ParAccel database platform, which can be accessed using SQL. Users can connect to the Amazon Redshift data warehouse using standard PostgreSQL JDBC or ODBC drivers. In addition, Amazon Redshift is already certified by Jaspersoft and MicroStrategy, two of the leading BI tools in the marketplace.
SQL does not provide a built-in capability to find duplicates in a table. Fortunately, it is fairly easy to write a SQL query that does it. The idea is to count the number of occurrences for each value, and then use the HAVING condition to show only the values that appear more than once.
SELECT COLUMN_NAME, COUNT(*)
GROUP BY COLUMN_NAME
HAVING (COUNT(*) > 1);
Best of the Web (BOTW) has just announced its biggest sale in 2012: Use Promo Code CYBER50 to get 50% off all listings. This promo code is good for 2012 Cyber Monday (November 26, 2012) only.
I have been following BOTW’s promotions this year, and the best I’ve found so far is 20% off. So, if you’ve been thinking about submitting to the BOTW directory, but have been hesitant because of the price, now is the time to act!
There are many occasions when we want to transfer files between our Android device and our PC. One way to do this is to connect the Android device to the PC via a USB cable. On the other hand, sometimes this does not work for a variety of reasons. Below I describe how I set up my Android and PC so I can transfer files between them.
File transfer from Android to PC
I use Bluetooth for this, and there are two components: Hardware and software. On the hardware side, you’ll want to make sure your PC is Bluetooth-ready. My PC did not have Bluetooth capabilities, so I bought a Bluetooth adapter (IOgear IOGBU421) to make sure my PC can communicate via Bluetooth. On the software side, I used Bluetooth OBEX File Transfer from Medieval Software. I downloaded and installed the PC version, and then I downloaded and installed the Android app version to my Android phone. Both versions are free. Once installations are complete, start the app in Android, and then open the file transfer program in PC. You’ll be able to connect to your Android device and download the files from your Android device.