An intermediate server (112; 113) comprising: a cryptography processing means that is configured to encrypt or decrypt data stored in a database; a query conversion means that is configured to: convert a query to the database into a first query that does not need processing by the cryptography processing means and a second query that needs the processing by the cryptography processing means, classify a selection condition included in the query to the database into a first selection condition that does not need the processing by the cryptography processing means and a second selection condition that needs the processing by the cryptography processing means, classify a table included in the query into a first table that is referred to only the first selection condition and a remaining second table, generate the first query on the basis of the first selection condition and the first table, and generate the second query on the basis of the second selection condition, the second table, and a result of the first query acquired from the database server; and a query processing means that is configured to send the first query to a database server connected to the database to acquire the result from the database server, and is configured to execute the second query using the cryptography processing means. a cryptography processing means that is configured to encrypt or decrypt data stored in a database; a query conversion means that is configured to: convert a query to the database into a first query that does not need processing by the cryptography processing means and a second query that needs the processing by the cryptography processing means, classify a selection condition included in the query to the database into a first selection condition that does not need the processing by the cryptography processing means and a second selection condition that needs the processing by the cryptography processing means, classify a table included in the query into a first table that is referred to only the first selection condition and a remaining second table, generate the first query on the basis of the first selection condition and the first table, and generate the second query on the basis of the second convert a query to the database into a first query that does not need processing by the cryptography processing means and a second query that needs the processing by the cryptography processing means, classify a selection condition included in the query to the database into a first selection condition that does not need the processing by the cryptography processing means and a second selection condition that needs the processing by the cryptography processing means, classify a table included in the query into a first table that is referred to only the first selection condition and a remaining second table, generate the first query on the basis of the first selection condition and the first table, and generate the second query on the basis of the second selection condition, the second table, and a result of the first query acquired from the database server; and a query processing means that is configured to send the first query to a database server connected to the database to acquire the result from the database server, and is configured to execute the second query using the cryptography processing means.