SQL has been the result of years of query language research, and has many desirable properties.We introduce DSQL - a language that is based on a theoretical foundation of a declarative language (document calculus) and an equivalent procedural language (document algebra). The outcome of this design is a language that looks and feels like SQL, yet is powerful enough to perform a vast range of queries on structured documents (currently focused on XML). The design of the language is independent of document formats, so the capability of the language will not change if the underlying markup language were changed. In spite of its familiarity and simplicity, we show that this language has many desirable properties, and is a good candidate for a viable query language for XML. This paper presents a canonical form of DSQL, showing only the properties of the language that affect the complexity of the language. Remarkably, SQL = core DSQL for flat input and outputs.