Check SQL queries with Mimer Validator

  • 2020-06-03 08:40:01
  • OfStack

Q: Suppose I have a table with (a,b,c,d) and (a,b) combined keys. Can I write this query in column values? Such as:

select a,c,d from mytable 
where (a,b) in ((1,2),(1,4),(1,5)) 

A: Yes.
If you doubt the validity of some SQL architectures, run under 1 via Mimer Validator. In this case, your query (the query in your logon verifier) will result in the following:
* In SQL-92, invalid
* In SQL-99 and SQL_2003, valid with the following comments:
F641, "Row and table constructors"
T051, "Row types"
F561, "Full value expressions"
The following features other than Core ES26en-99 or Core ES28en-200ES29en (draft) are used:
F641, "Row and table constructors"
T051, "Row types"
F561, "Full value expressions"
That is, if your particular database system does not support those selected features, you will still receive an error message.
Maybe you want to try the following query:
SELECT a,c,d
FROM mytable
WHERE a = 1 AND b = 2
OR a = 1 AND b = 4
OR a = 1 AND b = 5
This query runs 10 points smoothly because (a,b) is just one key, so it is more efficient to use an index query.

Related articles: