Thursday, 23 June 2016
Sunday, 1 May 2016
TO CHECK WHETHER THE TWO TABLES HAVE THE IDENTICAL DATA OR NOT
Create Two tables with Similar Structure and
same number of rows but with different values as shown below
OUTPUT:
If all the
Counts are Similar then we can say that the records are identical or same, if
the Count is different then two table
have different data. According to the O/P Count is not Similar, so two tables
are not having the identical data.
Eliminating Duplicate Records From a Table
ID 2,3 and 4 are repeated Multiple times. Now let's see the different ways to delete the duplicate Records.
First Method:
Using
'Distinct' Keyword copy the distinct records to temporary place, after that
delete the total records from the table. Now copy the distinct data from
temporary place to the table. Here am storing the data temporarily in
'Temporary Table' as Shown below.
Second Way:
First we need
to add an Identity Column to the Table. Use Rank Function with partition By
EMPID and NAME. And now if the Rank >
1 that means it's a duplicate record, So delete those records. Once the
Operation is completed remove identity column from the table.
Fourth Way:
Friday, 29 April 2016
Subscribe to:
Comments (Atom)









