Abstract-A statistical database (SDB) publishes statistical queries (such as sum, average, count, etc) on subsets of records. Sometimes by stitching the answers of some statistics, a malicious user (snooper) may be able to deduce confidential information about some individuals. The key representation auditing scheme is proposed to guarantee the security of online and dynamic SDBs. The core idea is to convert the original database into key representation database (KRDB), also this scheme involves converting each new user query from string representation into key representation query (KRQ), and stores it in the Audit Query table (AQ table). Three audit stages are proposed to repel the attacks of the snooper to the confidentiality of the individuals. In this paper, efficient algorithms for these stages are presented, namely the First Stage Algorithm (FSA), the Second Stage Algorithm (SSA), and the Third Stage Algorithm (TSA). These algorithms enable the key representation auditor (KRA) to conveniently specify the illegal queries which could lead to disclosing the SDB. Also, cost estimation for this scheme is performed, and we illustrate the saving in block accesses (CPU time) and storage space that are attainable when a KRDB is used.