Q: If my table contains (a,b,c,d) and (a,b) Form a combination of keys. Can I write this query in the column value? For example:
Copy Code code as follows:
Select A,c,d from MyTable
where (A,b) in ((1,2), (1,4), (1,5)
Answer: Yes.
If you suspect that some SQL schema is valid, run it through Mimer Validator. In this case, your query (the query you log in to the validator) will have the following results:
* in SQL-92, invalid
* In SQL-99 and sql_2003, valid and with the following comments:
F641, "Row and table constructors"
T051, "Row types"
F561, "Full value expressions"
The following features or core sql-200x (draft) are used beyond the core SQL-99:
F641, "Row and table constructors"
T051, "Row types"
F561, "Full value expressions"
This means that if your particular database system does not support those selection features, you will still receive the error message.
Perhaps you would like 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 works very well because (A,B) is a key, so it is more efficient to use an index query.