Find Duplicates in SQL

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.

HAVING (COUNT(*) > 1);

Continue reading

File Transfer Between Android and PC

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.

Continue reading

Copy a table in SQL

In a relational database, sometimes there is a need to copy a table in SQL. This post talks about several different scenarios on doing this, and how to use SQL to accomplish each scenario.

Copy a table with all data

To copy a table with all the data, simply create a new table and populate the table with SELECT * from the original table. This will copy over the table structure as well as all the data that was in the original table.

The syntax you would use is


Please note that this will not copy over the constraints or indexes associated with this table.

Continue reading