Constant sets

To establish a view for the individual income tax rate worksheet:

Level Taxable Income Tax Rate Deduction
1 500 5% 0
2 2000 10% 25
3 5000 15% 125
4 20000 20% 375

SQL

CREATE VIEW tax_rate AS
    SELECT 1 level, 500 payable_inc, 0.05 tax_rate, 0 deduction
    FROM dual UNION
    SELECT 2, 2000, 0.1, 25 FROM dual UNION
    SELECT 3, 5000, 0.15, 125 FROM dual UNION
    SELECT 4, 20000, 0.2, 375 FROM dual

The text-style SQL code cannot neatly align the constants presented in the table.

SPL

A B C D
1 1 500 5% 0
2 2 2000 10% 25
3 3 5000 15% 125
4 4 20000 20% 375
5 =create(level,payable_inc,tax_rate,deduction).record([A1:D4])

The grid-style SPL code displays the data in a more intuitive and neater way.

In order to simplify the SQL statement as much as possible in the examples, the window functions of SQL 2003 standard are widely used, and accordingly the Oracle database syntax which has best support for SQL 2003 is adopted in this essay.