Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2003, 05:11 AM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Request comparison

hi

I have troubles in doing SQL request comparison. I need to know if 2 sql request are equal. I think I need some logical language as Isabelle/HOL to find if 2 SQL request do the same result...
the syntaxical and grammatical analysis are not enough because 2 different request can give the same result. Moreover 2 requests can give the same results for a set of data and can give different result for another set of data... so comparing the request or their results in not enaugh to say that two requests are the same...

does anyone know how I can do this any tips to help me?

thank you

 
Old September 29th, 2003, 08:54 AM
Registered User
 
Join Date: Sep 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try to use logical operations like MINUS, UNION and INTERSECT.

e.g.

select * from tab1
MINUS
select * from tab2

would return every record in tab1 that is not in tab2


select * from tab1
INTERSECT
select * from tab2

would return all records that are present in both queries.


Something like

(select * from tab1
 UNION
 select * from tab2
)
 MINUS
(select * from tab1
 INTERSECT
 select * from tab2
);

should do the complete job and return every record that was not returned by both queries.

dunno if this is standard sql but it works well and very fast with oracle.
 
Old September 29th, 2003, 09:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

UNION and INTERSECT are SQL 92 compliant, I don't know about MINUS though. There is a SQL 92 compliant way of doing it but I am not sure if MINUS is the appropiate one, it might be though.

Regards
Owain Williams
 
Old September 29th, 2003, 10:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

EXCEPT is the SQL-92 equivalent of Oracle's MINUS, I believe.

(Not many RDBMS's support INTERSECT and EXCEPT, though...)

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
request forwarging & request redirection hafizmuhammadmushtaq Servlets 2 April 24th, 2008 12:42 AM
Using sql request/response adapter with Biztalk shazza SQL Language 2 May 15th, 2007 02:07 PM
Request.Form / Request.QueryString Toran Classic ASP Databases 4 January 17th, 2007 02:23 PM
How to do case sensitive comparison in SQL SERVER leo_vinay Classic ASP Databases 2 January 24th, 2005 01:46 PM
request.querystring() , request.form() alyeng2000 ASP.NET 1.0 and 1.1 Basics 1 December 30th, 2003 12:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.