notes on a theoretical query database