Database programming: sample database construction, query result caching and performance, views, triggers, and materialized views