<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="functionalView" maxOccurs="1" minOccurs="1">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="columns">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="column" maxOccurs="unbounded" minOccurs="1">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="name" use="required"/>
                      <xs:attribute type="xs:string" name="columnAlias" use="required"/>
                      <xs:attribute type="xs:string" name="description" use="required"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="fromviews" maxOccurs="1" minOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="fromview" maxOccurs="unbounded" minOccurs="2">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="name" use="required"/>
                      <xs:attribute type="xs:string" name="alias" use="required"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="joins" maxOccurs="1" minOccurs="1">
          <xs:complexType>
            <xs:choice maxOccurs="unbounded" minOccurs="1">
              <xs:element name="join" maxOccurs="unbounded" minOccurs="0">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="alias1" use="required"/>
                      <xs:attribute type="xs:string" name="col1" use="required"/>
                      <xs:attribute type="xs:string" name="condition" use="required"/>
                      <xs:attribute type="xs:string" name="alias2" use="required"/>
                      <xs:attribute type="xs:string" name="col2" use="required"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="leftouterjoin" maxOccurs="unbounded" minOccurs="0">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="alias1" use="required"/>
                      <xs:attribute type="xs:string" name="col1" use="required"/>
                      <xs:attribute type="xs:string" name="condition" use="required"/>
                      <xs:attribute type="xs:string" name="alias2" use="required"/>
                      <xs:attribute type="xs:string" name="col2" use="required"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:complexType>
        </xs:element>
        <xs:element name="where" maxOccurs="1" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="condition" maxOccurs="unbounded" minOccurs="1">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="alias1" use="required"/>
                      <xs:attribute type="xs:string" name="col1" use="required"/>
                      <xs:attribute type="xs:string" name="operator" use="required"/>
                      <xs:attribute type="xs:string" name="string" use="optional"/>
                      <xs:attribute type="xs:string" name="number" use="optional"/>
                      <xs:attribute type="xs:string" name="date" use="optional"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute type="xs:string" name="name"/>
      <xs:attribute type="xs:string" name="description"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

