-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
333 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,7 +243,7 @@ | |
</select> | ||
</create-view> | ||
|
||
<create-view sql-case-id="create_view_as_simple_select" view-definition="SELECT * FROM laurel.emp"> | ||
<create-view sql-case-id="create_view_as_simple_select1" view-definition="SELECT * FROM laurel.emp"> | ||
<view name="employee" start-index="12" stop-index="26"> | ||
<owner name="laurel" start-index="12" stop-index="17" /> | ||
</view> | ||
|
@@ -259,6 +259,20 @@ | |
</select> | ||
</create-view> | ||
|
||
<create-view sql-case-id="create_view_as_simple_select2" view-definition="SELECT * FROM scott.dept"> | ||
<view name="dept" start-index="12" stop-index="15" /> | ||
<select> | ||
<projections start-index="27" stop-index="27"> | ||
<shorthand-projection start-index="27" stop-index="27" /> | ||
</projections> | ||
<from> | ||
<simple-table name="dept" start-index="34" stop-index="43"> | ||
<owner name="scott" start-index="34" stop-index="38" /> | ||
</simple-table> | ||
</from> | ||
</select> | ||
</create-view> | ||
|
||
<create-view sql-case-id="create_view_as_where_where" view-definition="SELECT employee_id, last_name, department_id FROM employees, departments WHERE employees.department_id = departments.department_id"> | ||
<view name="employees_departments" start-index="12" stop-index="32" /> | ||
<select> | ||
|
@@ -410,4 +424,164 @@ | |
</combine> | ||
</select> | ||
</create-view> | ||
|
||
<create-view sql-case-id="create_view_with_object_identifier1" view-definition="SELECT e.empnum, e.ename, e.salary, e.job FROM emp_table e WHERE job = 'Developer'"> | ||
<view name="emp_view1" start-index="12" stop-index="20" /> | ||
<select> | ||
<projections start-index="77" stop-index="110"> | ||
<column-projection name="empnum" start-index="77" stop-index="84"> | ||
<owner name="e" start-index="77" stop-index="77" /> | ||
</column-projection> | ||
<column-projection name="ename" start-index="87" stop-index="93"> | ||
<owner name="e" start-index="87" stop-index="87" /> | ||
</column-projection> | ||
<column-projection name="salary" start-index="96" stop-index="103"> | ||
<owner name="e" start-index="96" stop-index="96" /> | ||
</column-projection> | ||
<column-projection name="job" start-index="106" stop-index="110"> | ||
<owner name="e" start-index="106" stop-index="106" /> | ||
</column-projection> | ||
</projections> | ||
<from> | ||
<simple-table alias="e" name="emp_table" start-index="117" stop-index="127" /> | ||
</from> | ||
<where start-index="129" stop-index="151"> | ||
<expr> | ||
<binary-operation-expression start-index="135" stop-index="151"> | ||
<left> | ||
<column name="job" start-index="135" stop-index="137" /> | ||
</left> | ||
<right> | ||
<literal-expression value="Developer" start-index="141" stop-index="151" /> | ||
</right> | ||
<operator>=</operator> | ||
</binary-operation-expression> | ||
</expr> | ||
</where> | ||
</select> | ||
</create-view> | ||
|
||
<create-view sql-case-id="create_view_with_object_identifier2" view-definition="SELECT d.deptno, d.deptname, address_t(d.deptstreet,d.deptcity,d.deptstate,d.deptzip) AS deptaddr FROM dept d"> | ||
<view name="dept_view" start-index="12" stop-index="20" /> | ||
<select> | ||
<projections start-index="74" stop-index="163"> | ||
<column-projection name="deptno" start-index="74" stop-index="81"> | ||
<owner name="d" start-index="74" stop-index="74" /> | ||
</column-projection> | ||
<column-projection name="deptname" start-index="84" stop-index="93"> | ||
<owner name="d" start-index="84" stop-index="84" /> | ||
</column-projection> | ||
<expression-projection alias="deptaddr" text="address_t(d.deptstreet,d.deptcity,d.deptstate,d.deptzip)" start-index="96" stop-index="163"> | ||
<expr> | ||
<function function-name="address_t" text="address_t(d.deptstreet,d.deptcity,d.deptstate,d.deptzip)" start-index="96" stop-index="151"> | ||
<parameter> | ||
<column name="deptstreet" start-index="106" stop-index="117"> | ||
<owner name="d" start-index="106" stop-index="106" /> | ||
</column> | ||
</parameter> | ||
<parameter> | ||
<column name="deptcity" start-index="119" stop-index="128"> | ||
<owner name="d" start-index="119" stop-index="119" /> | ||
</column> | ||
</parameter> | ||
<parameter> | ||
<column name="deptstate" start-index="130" stop-index="140"> | ||
<owner name="d" start-index="130" stop-index="130" /> | ||
</column> | ||
</parameter> | ||
<parameter> | ||
<column name="deptzip" start-index="142" stop-index="150"> | ||
<owner name="d" start-index="142" stop-index="142" /> | ||
</column> | ||
</parameter> | ||
</function> | ||
</expr> | ||
</expression-projection> | ||
</projections> | ||
<from> | ||
<simple-table alias="d" name="dept" start-index="170" stop-index="175" /> | ||
</from> | ||
</select> | ||
</create-view> | ||
|
||
<create-view sql-case-id="create_view_select_host_table" view-definition="SELECT a.empno, a.ename, b.dname FROM scott.emp a, [email protected] b WHERE a.deptno = b.deptno"> | ||
<view name="company" start-index="12" stop-index="18" /> | ||
<select> | ||
<projections start-index="30" stop-index="54"> | ||
<column-projection name="empno" start-index="30" stop-index="36"> | ||
<owner name="a" start-index="30" stop-index="30" /> | ||
</column-projection> | ||
<column-projection name="ename" start-index="39" stop-index="45"> | ||
<owner name="a" start-index="39" stop-index="39" /> | ||
</column-projection> | ||
<column-projection name="dname" start-index="48" stop-index="54"> | ||
<owner name="b" start-index="48" stop-index="48" /> | ||
</column-projection> | ||
</projections> | ||
<from> | ||
<join-table join-type="COMMA"> | ||
<left> | ||
<simple-table name="emp" alias="a" start-index="61" stop-index="71"> | ||
<owner name="scott" start-index="61" stop-index="65" /> | ||
</simple-table> | ||
</left> | ||
<right> | ||
<simple-table name="dept" alias="b" start-index="74" stop-index="100"> | ||
<owner name="jward" start-index="74" stop-index="78" /> | ||
</simple-table> | ||
</right> | ||
</join-table> | ||
</from> | ||
<where start-index="102" stop-index="126"> | ||
<expr> | ||
<binary-operation-expression start-index="108" stop-index="126"> | ||
<left> | ||
<column name="deptno" start-index="108" stop-index="115"> | ||
<owner name="a" start-index="108" stop-index="108" /> | ||
</column> | ||
</left> | ||
<right> | ||
<column name="deptno" start-index="119" stop-index="126"> | ||
<owner name="b" start-index="119" stop-index="119" /> | ||
</column> | ||
</right> | ||
<operator>=</operator> | ||
</binary-operation-expression> | ||
</expr> | ||
</where> | ||
</select> | ||
</create-view> | ||
|
||
<create-view sql-case-id="create_view_select_function_group_by_order_by" view-definition="SELECT deptno, MIN(sal), AVG(sal), MAX(sal) FROM emp GROUP BY deptno ORDER BY deptno"> | ||
<view name="dept_salaries" start-index="12" stop-index="24" /> | ||
<select> | ||
<projections start-index="36" stop-index="71"> | ||
<column-projection name="deptno" start-index="36" stop-index="41" /> | ||
<aggregation-projection type="MIN" expression="MIN(sal)" start-index="44" stop-index="51"> | ||
<parameter> | ||
<column name="sal" start-index="48" stop-index="50" /> | ||
</parameter> | ||
</aggregation-projection> | ||
<aggregation-projection type="AVG" expression="AVG(sal)" start-index="54" stop-index="61"> | ||
<parameter> | ||
<column name="sal" start-index="58" stop-index="60" /> | ||
</parameter> | ||
</aggregation-projection> | ||
<aggregation-projection type="MAX" expression="MAX(sal)" start-index="64" stop-index="71"> | ||
<parameter> | ||
<column name="sal" start-index="68" stop-index="70" /> | ||
</parameter> | ||
</aggregation-projection> | ||
</projections> | ||
<from> | ||
<simple-table name="emp" start-index="78" stop-index="80" /> | ||
</from> | ||
<group-by> | ||
<column-item name="deptno" start-index="91" stop-index="96" /> | ||
</group-by> | ||
<order-by> | ||
<column-item name="deptno" order-direction="ASC" start-index="107" stop-index="112" /> | ||
</order-by> | ||
</select> | ||
</create-view> | ||
</sql-parser-test-cases> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.