Let us begin with understanding what is a sequence number in a table.Sequence number in a database table is simply a column which has incremental value i.e. the new value will be last maximum value + 1 (in most cases it is incremented by 1 however you can change it also as per your requirement).Sequence numbers are generally used as surrogate keys.Surrogate keys can help us in recognizing any record in a table uniquely.Major difference between Primary Keys and Surrogate keys is Surrogate Keys don’t store much information and mostly it is a number value only.
So let us see now how to implement sequence number in any Database Table using simple SQL.Read More →

Suppose you have a list of Files that you need to tar.All the files name are present in a single file.
eg. In one file FileList.txt you have several files : File1 , File2 ,File3 etc.
tr ‘\n’ ‘ ‘ FileList.txt FileList1.txt
mv FileList1.txt FileList.txt
sed ‘${/^$/!s/$/\ /;}’ FileList.txt
tar cvf MyTar.tar `head -1 FileList.txt`Read More →

One of the most common problem faced by people working on Databases is :
TO INSERT RECORDS IN A TABLE ONLY IF IT IS A NEW RECORD ELSE UPDATE THE EXISTING RECORD.
Many people give different possible solution for it. Some even suggests using some inbuilt functions specific to some Databases. However I thought of sharing a generic method which can be easily applied to any database and without any dependency.
The easiest way to implement INSERT RECORDS ONLY IF IT IS NEW ELSE UPDATE is by adding new column name FLAG which will help in determining whether we need to insert record or update it.
A query implementing it in a general form can be:Read More →