.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

How To retrive Duplicate Records when There is no Primary key in a Table?

Posted By :Mallikarjuna Chigicherla     Posted Date :August 05, 2010    Points :10   Category :Sql Server 
select city_name
from areas
group by city_name

having count(*) > 1

You can also find related Interview Question to How To retrive Duplicate Records when There is no Primary key in a Table?  below: 

How to select all duplicate records from a table ?

  
select field, count(field) from TableName group by field having count(*) > 1

where two (or more) records are considered duplicates if they having a common value for a single field (More...)

How to select records from a table where some column names are duplicate and some are different ?

  
select * from table as A, table as B where A.field1=B.field1 and A.field2=B.field2 and A.field3<>B.field3 (More...)

How to get last five minuts records from Oracle Databse table?

  
select col_datetime,sysdate from tblname where trunc(col_datetime)=trunc(sysdate) and to_char(col_datetime,'dd-mm-yyyy hh24:mi:ss')>to_char(sysdate- interval '05' minute,'dd-mm-yyyy hh24:mi:ss')
(More...)

If you 1Lakh records of employee in a table, then how will you get the 4th highest salary from the table?

  
SELECT TOP 1 * FROM [EmpTable] WHERE [salary] NOT IN (SELECT DISTINCT TOP 3 salary FROM [temp1] ORDER BY [salary] DESC) ORDER BY salary DESC (More...)

Would the select query below fetch any records?



create table #testvm (ID int)

select * from sysobjects where name = '#testvm'

drop table #testvm

  
No..

Since temp tables are created in tempdb, and use a random name, the query will not work.

If you used a query like this, you would see your table:

select * from tempdb..sysobjects where name like '#testvm%' (More...)

How do we get primary key information in oracle table?

  
we can get primary key information with the following SQL statement

SELECT b.table_name, b.column_name, b.position, a.status, cons.owner
FROM all_constraints a, all_cons_columns b
WHERE cons.constraint_type = 'P'
AND a.constraint_name = b.constraint_name
AND a.owner = b.owner
ORDER BY b.table_name, b.position;
(More...)

Using query analyzer, name 3 ways to get an accurate count of the number of records in a table?

  
SELECT * FROM table1
SELECT COUNT(*) FROM table1
SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND indid < 2 (More...)

List the ways you can get total number of records in a table?

  
select count(*) from tablename
select rows from sysindexes where id=OBJECT_ID(tablename) and indid < 2
select * from tablename (More...)

Database: How many primary key constraints can be created for one table?

  
Only one primary key constraints can be created for one table. (More...)

How many Primary key in single table in sqlserver?

  
Primary key Restrict Duplicate Values and Null values .Each Table can have only one primary ..

Create table emp(empid int constraint pk_empid primary key(empid),empname varchar(90))

Regards
Sriram.R
www.databaseresource.blogspot.com (More...)

How to update record in a table using records in another table in SQL Server ?

  
update tableOne set tableOne.field1=tableTwo.fieldX from tableOne, tableTwo where tableOne.commonID=tableTwo.commonID (More...)

How to update record in a table using records in another table in SQL Server ?

  
update tableOne set tableOne.field1=tableTwo.fieldX from tableOne, tableTwo where tableOne.commonID=tableTwo.commonID (More...)

How to insert records in a table using records from existing table ?

  
insert into TableName (field1,field2,field3)
select colA,colB,colC from OtherTable (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend