sql-differential-privacy
sql-differential-privacy copied to clipboard
rewrite DP queries for SQL Server
The query rewriter on the example generated queries that are compatible with Vertica Database. I know you mentioned in your paper and this repo that the query generated by this method (elastic sensitivity and FLEX) can be executed against any SQL database. For example the Generated query in vertica is:
SELECT COUNT(*) + 20.0 * (CASE WHEN RAND() - 0.5 < 0 THEN -1.0 ELSE 1.0 END * LN(1 - 2 * ABS(RAND() - 0.5)))
FROM (SELECT timezoneOffset
FROM TSMC2014) t
WHERE timezoneOffset = '540'
the SQL Server version of this would be (Difference in LN vs. LOG):
SELECT COUNT(*) + 20.0 * (CASE WHEN RAND() - 0.5 < 0 THEN -1.0 ELSE 1.0 END * LOG(1 - 2 * ABS(RAND() - 0.5)))
FROM (SELECT timezoneOffset
FROM TSMC2014) t
WHERE timezoneOffset = '540'
similar for MOD(n,m)
in vertical which is equivalent to n % m
in SQL Server and perhaps there are more functions that are not compatible.
How can we get this working with SQL Server? In other words what is the most optimized way to make this code compatible with other SQL Databases (e.g. SQL Server) Thanks