Withthe proliferation of database views and curated databases, the issue of data provenance where a piece of data came from and the process by which it arrived in the database is becoming increasingly important, especially in scienti c databases where understanding provenance is crucial to the accuracy and currency of data. In this paper we describe an approach to computing provenance when the data of interest has been created by a database query. We adopt a syntactic approach and present results for a general data model that applies to relational databases as well as to hierarchical data such as XML. A novel aspect of our work is a distinction between why" provenance refers to the source data that had some in uence on the existence of the data and where" provenance refers to the locations in the source databases from which the data was extracted.