K
K
KlassT2017-06-13 16:10:30
SQL
KlassT, 2017-06-13 16:10:30

How to check 2 sql queries for full match?

There are 2 requests. One is known initially (the answer to the task), and the second comes from the frontend. It is necessary to check for a FULL match of the query results. Answers of the form: well, dig in the direction of EXCEPT / INTERSECT are not interested. Copal. A query like SELECT id_connection FROM tasks EXCEPT SELECT id FROM tasks doesn't throw any errors and runs smoothly. Maybe someone already has a ready request?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2017-06-13
@Sanasol

Isn't it easier to compare the result after the request?

T
terrier, 2017-06-13
@terrier

As I understand it, you would like the column names and types to be exactly the same?
As far as I understand, there is no portable way to do this, so the easiest way is
1). Get column names from both queries. Compare.
2) Get column types from both queries. Compare.
3). And now after that - EXCEPT.
All this in a way specific to your database.
If everything matches, the requests are identical.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question