Two databases

Hello,

I have two databases one is student_Name and another is student_Name1...Two tabled contain 200 records each..I found that near 30 names are entered in both databases..I would like to remove the duplicates..and i have to keep the name which is newly added..Please hepl how to remove duplicates with shell

Thank u.

 
DELETE student_Name1 WHERE name IN (SELECT name FROM student_Name) 

Thank you.

In my databases i have the same table with same column
EX : First database
i have a table Employee with column empname
second database : also i have the same table Employee with same column empname

I need compare this two tables of the column empname

Please get me the solution..

Thanks,

Hello Anjali,

First of it's Data Base related topic and not sure why you posted here.

However,

Assuming that you are using Oracle as Data Base.

In order to access two "same" tables created in two different schemas, you have to have grant privilges. Assuming all are in place:

This will give you the common "rows" from two tables:

 
select empname from Employee where empname in (select empname from schema2.Employee)

This will give you the rows present in Schema1 Employee table but not in Schema2:

 
select empname from Employee where empname not in (select empname from schema2.Employee)

Read Oracle Documents for more information on this.

select * from 1.employee
minus 
select * from 2.employee

What kind of SQL syntax is 'minus' ?

Anjali, you're probably looking for a JOIN between the tables.

To answer your question as to the same column name being in both tables, you have to fully qualify each column if their names are shared (actually, it's a good idea to fully qualify with the abbreviated name at this point).

So, if you had two tables, such as Student and Student_Grades, both which had a Student_ID column, you would qualify it as Student.Student_ID and Student_Grades.Student_ID .

The wikipedia article that I linked has a good example of JOINs and the qualified naming that you have to do (in their example, it's an employee and their department).

oracle supports minus

Minus - Oracle FAQ

Oracle UNION, INTERSECT, MINUS operators and Sorting Query Result

itkamaraj, interesting, thanks for the link. Is there a difference between doing a LEFT OUTER JOIN on the original versus a minus operation?