Patent attributes
A first database account shares, with a second database account, a secure function configured to accept an encrypted dataset and a decryption parameter. The first database account includes a first dataset. The second database account includes a second dataset. The second database account selects one or more rows and one or more columns of the second dataset as a searchable dataset, generates an encrypted searchable dataset by encrypting the searchable dataset with a key, and calls the secure function with the encrypted searchable dataset and the key. The secure function generates results of a query by: generating a decrypted searchable dataset by decrypting the encrypted searchable dataset with the key in a secure environment, obtaining the results by executing the query against a combination of the first dataset and the decrypted dataset in the secure environment to generated query-results data, and outputting the results to the second database account.