sql compare tables

Solutions on MaxInterview for sql compare tables by the best coders in the world

showing results for - "sql compare tables"
Jonathan
05 Apr 2017
1(SELECT * FROM T1 MINUS SELECT * FROM T2)   -- Rows that are in T1 but not in T2
2UNION ALL
3(SELECT * FROM T2 MINUS SELECT * FROM T1);  -- Rows that are in T2 but not in T1
Leni
17 Sep 2017
1-- Find the different tables and columns between DB_NBR_1 and DB_NBR_2
2-- (just replace DB_NBR_1 and DB_NBR_2)
3select isnull(db1.table_name, db2.table_name) as [table],
4       isnull(db1.column_name, db2.column_name) as [column],
5       db1.column_name as scripts_col_name
6      ,db1.column_type as scripts_col_type
7       ,db1.column_precision as scripts_col_precision
8
9      ,db2.column_name as liquid_col_name
10      ,db2.column_type as liquid_col_type
11      ,db2.column_precision as liquid_col_precision
12from
13(select schema_name(tab.schema_id) + '.' + tab.name as table_name, 
14       col.name as column_name
15      ,y.name as column_type
16      ,y.precision as column_precision
17   from [DB_NBR_1].sys.tables as tab
18        inner join [DB_NBR_1].sys.columns as col
19            on tab.object_id = col.object_id
20         JOIN sys.types y ON y.user_type_id = col.user_type_id
21         ) db1
22full outer join
23(select schema_name(tab.schema_id) + '.' + tab.name as table_name, 
24       col.name as column_name
25      ,y.name as column_type
26      ,y.precision as column_precision
27   from [DB_NBR_2].sys.tables as tab
28        inner join [DB_NBR_2].sys.columns as col
29            on tab.object_id = col.object_id
30         JOIN sys.types y ON y.user_type_id = col.user_type_id
31         ) db2
32on db1.table_name = db2.table_name
33and db1.column_name = db2.column_name
34where (db1.column_name is null or db2.column_name is null)
35order by 1, 2, 3
36
Assia
27 Jan 2018
1select * from tableA
2minus
3select * from tableB
4
queries leading to this page
how to find differences between two sql tablessql server compare two tablesdata compare separate sql serverssql compare two tables for differencescomparer deux tables sqlcompare which record is not present in sqltsql find records that are different between setssql server compare data in two databaseshow do i compare two tables in matched records in sql 3fcompare two tables in sql for differenceshow do i find 2 differences between tables in sqlsql difference between two tables joincompare table sqlcompare tableshow to compare whole column with a record in sqlhow to compare two table data in oraclecompare coluomns of diffferent table innswltable to find differencescompare records in two tables sqlhow to compare two values from different tables in sqlhow to check differenct from 2 diferent tables sqlcomparing values in the same table sqlsql compare tablesql 2 table comparewhere clause distinct compare 2 tablestwo different table differencequery to compare two tables in sqlcompare 2 table data in sqlsql compare tab 22msql 22 compare tablescompare two tables all column in sql server for differencesquery to find difference between two tables in sqlcompare 2 values in sql queries from 2 tablessql compare columns between two tablessql how to compare two tables their valueshowto compare same tables in sqlsql show differences between two tablessql compare two tables with different columnscompare tex from two tables in sqlfind differences between two tables sqlwhere compare two tables sqlsql get table differencescompare data sql compare two table data in sqlsql difference between two tableshow to find the difference between two tables in sqlcomparing two data sources for differences sqlhow to compare tables in different databaseshow to differentiate between two table ids in join on row arryhow to compare values from two tables in sqlsql to compare columns in two tablesselect difference in two rows in table tablecompare record sql serversql difference tablecompare values between tables sqlminus in oracle sqlsql queries to compare two tablessql compare two tables columnsoracle query minussame two table to get same data by compare columnsdifference between two columns in sqlsql query to compare two tables and find records with matcheshow to compare data in two tables in sqlcompare two tables in sql oraclesql difference between two columnssql server compare two tablecompare two tables and return differences sqlhow to find data with discrepancy in sql serverdiff data two tables sqldifference between two tables compare fileds of two db tableshow to compare attributes in sql tables for differencescompare 2 sql query for differencessql compare datacompare sqlcompare data in two sql tablescompare two different tables in sqlsql compare 2 queries for differencescompare two table sql querysql two tables data comparehow to compare data in two tables in sql select differencefind difference between two tables sqlcomparing 2 records from different tables in sqlcompare tables sql serversql 2 tables differencesql compare tables in databasecomparing 2 table in sqlsql compare values in two tablessql how to compare datehow to find difference between two tables in sql accesshow to compare tables in 2 different sql databaseshow to compare data in different sql serverhow to select the difference between two tablescompare two table column values with if statement in sqlcompare two sql tables for differencessql where 2 table values are equalhow to compare two columns from two different tables in sqlsql compare two columns from different tablescompare 2 tables in sql for columnshow to compare two values from diffrent sql tablesmssql compare two tablescompare two tables in sqlcomparing two sql tables with different named idsfind diff between two same tableshow to compare data of two tables in sqlcompare two tables with t sqlcompare 2 sql tablescompare two tables sql differenceshow to compare value in tables in sql serversql return difference in number of rows in two tablecompare two tables in sql for differences from different databasessql 2 different database compare rows where ids are the samecompare sql resultssql compare two tables valuessql compare values between two tablessql compare datesequate values from a table to another tablecompare 2 tables sql find different value in each row fo two tableshow to compare two strings in sql select querysql compare to tablesdifferent data two tables sqlsql diff two tablescompare 2 tables sql server 2 databasehow to compare 2 tables in sqlhow to find difference value between 2 tables in sqlsql table differences comparehow to compare data in two tables in sql servercompare 2 table columns sqlcalculate difference 2 table sqlsql two table differencecheck for a match in 2 data bases columnssql compare tables for differencessql check if two tables have the same columnshow to diff 2 tables sqldifference syntax in sqlcompare table entries sqlcomparing same table values in sqlcompare two tables to check the different databases sqlcomparing two tables in sqlsql compare two table all columncompare fields of two db tables sqlcompare two tables in sql and find only matching datafinding difference between two tables in sqlcompare two mssql tablescompare two sql tableshow to compare data between two tablescompare tables in two my sql databases for differenceshow to compare 2 rows in sqlcompare 2 tables in sql serversql compare two tables and find records with matchescomparing tables in sqloracle sql minusshow different data types between two same tables in mysqlcompare data with sqlcomparing two tables in oraclecompare value from sql to other valuehow to compare two tables in sql and find differences sql servercheck for similarities between all rows in sqlhow to compare two tables in different sql databaseshow to compare two columns from different tables in sqlhow to find difference between 2 tables in sqlhow to compare two tables in sql and find differencessql compare data from two tablesif two records have different data in sqlsql compare 2 tables for differences and print mismatched columnscomparing data in 2 tables on sqlcompare datatype of two tablecompare two tables sqlhow to compare values in two different tables in sqlquery to use when to compare to tables from different dtabasessql query compare 2 tablescompare different table columnscolumn comparison in sql server for two datasetminus sql oraclesql comparing two tabeoracle compare datafind all differences in 2 tables sqlsql to get difference between two tableshow do you compare two tables in sqlsql compare two tables from two different databasescompare two sql queries for differencesquery to compare all the columns of a table sql server difference between two tablessql compare columns in two tablescompare tables in two databases for differencessql query to compare data in two tablescompare records in sql tablessql comparing tablescompare two tables in oracleoracle sql comparecompare all columns in two tables sqlsql compare two fields in different tablescompare two tables columns in sqlcompare sql statementcompare columns of different table in sqlcompare two table column values in sqlsql compare two rows of data for differencessql compare two tables to find differencescompare values of two tables in oraclecompare sql databases and find table differencessql compare two tabelsmysql compare 2 tables if they have same value of columnssql server compare two tables for differencessql how to compare two tablesc 23 compare 2 tables equal valuessql to compare 2 tableshow to select the difference between two tables in sql servert sql compare two tableshow to compare data in two tables in mssqlcompare data between two tables in sql servercompare column differences in two tables sqlsee if 2 values match in a table with sqlsql compare values from 2 tablescompare 2 tables in sqlsql differences between two tablesmatch two table columnmshow to compare two table in sqlsql comparesql query to check two tables have identical datasql 2 tables comparecompare two entities sqlhow to compare two table data in different database sqlcompare data of 2 tables in sql and display unique cell baluet sql compare two tables for differencesdiff two tablesdatabase compare two tablessql compare 2 table columnshow to know two select queries difference with same columnscompare two tables in sql server select difference between two tables sqlcompare two columns of different tables in sqlcompare tables in sqlhow to check difference between two tables in sqlcompare 2 values in 2 sql tablescompare dates in sqlquery to check difference between two tablescompare to database table sqlmsql compare tablesdifference two tables sqlhow to compare 2 databases tables values in sqlms sql compare data in two tablessql compare tableshow to find data difference between two tables in sql serverhow to compare two tables in sqlcompare from 2 tables sqldifference between two tables sqlfind diff between two same tables on different dbshow to compare and select two tables in sqlsql find difference between two tables 22sql server 22 compare two tablessql database differencessql server select difference between two tablessql compare records between two tables looking for changes sql compare two tablessql compare all colums of two rows data comparison sqlsql query to compare values of two tablesdifference between two tables in sqlbasic sql comparesql how to compare two tables there valuescompare values in two tables sqlcompare values in two sql tablescompare two tables in oracle for differencescompare 3 table data in sqlhow to compare two tables sql servercompare 2 tables in sql highlight differencesquery compare two tables sqlms sql compare two tablessql get the difference between two tablescompare 2 table sql serversql compare data of 2 tableshow to find the difference between two tables sqlcheck if two columns of different tables have same value psqlquery to check difference between by columns not consider one columncompare differences in two tables sqlcompare two columns from different tables sqlcompare two tables data in sql comapre two table from recent created datedifference between 2 tables sqlsql query to compare columns of two tableshow to check two different columns ranges in sqlt sql compare tableshow to compare data in same table sqlsql server compare column values between two tablescompare table sql querycheck two tables for no of data on column matchhow to compare two table columns in sqlhow to compare two tables in sql in different databasesdiff between 2 sqlsql differencecompare two rows in a table by a similair id and take the result sqlhow to compare two tables in different sql serverssql server find difference between two tablessql compare 2 tables for differencescheck difference between tables sql serverhow to match data table to other tablessql get difference between two tablescompare 2 columns values of sql dump matchescompare tables matching columns t sqlcompare tables matching columns sql sql compare two values in different tablescompare row differences sqlcompare columns in sqlmatch two tables in sql serversql table data compareoracle sql compare datasql query compare data two tablescompare two same tables in sqlcompare data between two tables in different sql servercomparing two data sets in tsqlcompare 2 tables sqlcompare same join tables sqlcompare values of two tables in sqlsql compare matching columns of two tablest sql how to find same data in 2 tableshow to compare two tables in sql serverhow to compare data in two sql server tableshow to comare with sqlhow to do a data compare in sql compare two tablestable of values to find differencessql query to compare two tablescompare two tables in sql server for differencestwo tables same exact data in sqlsql compare elemts on a tablehow to find difference between two tables in sqlhow to compare two tables data in sqlif data type is different then show those rows between two same tables in mysqlsql compare two table columnssql comparing output from 2 tablesdifference in sqlsql comparing two tables for differenceshow to compare more than two tables in sqlcomparing 2 tables in sqlmsql compare tables for differencescheck difference between tables sqlsql compare all columns in two tablesdata comparison between two tables in sql servercompare columns between sql tablessql server confront two tablecompare 2 different sql tablesmsql compare two tables for differencescompare data of two tables in sql serverhow to compare a file with sql table queryits possible to compare two equal table in diferent databasecomparing the data in the group by sql serversql query compare two tablessql difference of length between tablesquery to check difference between by columnshow to compare two table data in sqlcompare queries in sql tablesql 2 different database compare rowssql server compare element in field of two tableget difference between two tables sqlfind difference between two sql tablesoracle compare tablessql sentencia compare table structurehow to compare two different tables in sqlsql check other table equalt sql difference between 2 tablesdatabase table comparsioncompare difference in rows sql tabledif data two tables sqlcompare tables 27 sqlsql compare tables