How to execute a SELECT on a table with a list of composite keys?
If I have a table with columns like
> ID1 ID2 VAL1 VAL2

Where ID1,ID2 makes the primary key index.

How do I execute any SQL statements for specific ID1,ID2 values?

Example: I have table with records that has PK (1,1) (1,2) (2,4) (2,1) (3,1) (3,2) (3,5)

I want to only select records with (1,1) (1,2) (3,5) (3,2)

A SELECT query with

> SELECT * FROM tbl1 WHERE ID1 IN (1,3) AND ID2 IN (1,2,5)


will yield undesired result: (3,1). So what's the best way to do this?

I am looking for an overall answer for SQL, but if it is dependent on the DBMS, I would like to know how to do so in PostgreSQL and MySQL.
How to execute a SELECT on a table with a list of composite keys?
===

If I have a table with columns like
> ID1 ID2 VAL1 VAL2

Where ID1,ID2 makes the primary key index.

How do I execute any SQL statements for specific ID1,ID2 values?

Example: I have table with records that has PK (1,1) (1,2) (2,4) (2,1) (3,1) (3,2) (3,5)

I want to only select records with (1,1) (1,2) (3,5) (3,2)

A SELECT query with

> SELECT * FROM tbl1 WHERE ID1 IN (1,3) AND ID2 IN (1,2,5)


will yield undesired result: (3,1). So what's the best way to do this?

I am looking for an overall answer for SQL, but if it is dependent on the DBMS, I would like to know how to do so in PostgreSQL and MySQL.