SQL/MX 2.x Reference Manual (H06.10+, J06.03+)
SQL/MX Clauses
HP NonStop SQL/MX Reference Manual—544517-008
7-12
Examples of SAMPLE
,amount NUMERIC (9,2) UNSIGNED
,PRIMARY KEY (empid) );
CREATE TABLE $db.mining.dept
( dnum NUMERIC (4) UNSIGNED NOT NULL
,name VARCHAR (20)
,PRIMARY KEY (dnum) );
Within MXCI, the ANSI alias name has been mapped as:
CREATE SQLMP ALIAS db.mining.salesperson $db.mining.salesper;
CREATE SQLMP ALIAS db.mining.sales $db.mining.sales;
CREATE SQLMP ALIAS db.mining.department $db.mining.dept;
Suppose, too, that sample data is inserted into this database similar to the data in the
sample database.
•
Return the SALARY of the youngest 50 sales people:
SELECT salary
FROM salesperson
SAMPLE FIRST 50 ROWS SORT BY age;
SALARY
-----------
90000.00
90000.00
28000.00
27000.12
136000.00
37000.40
...
--- 50 row(s) selected.
•
Return the SALARY of 50 sales people. In this case, the table is clustered on
EMPID. If the optimizer chooses a plan to access rows using the primary access
path, the result consists of salaries of the 50 sales people with the smallest
employee identifiers.
SELECT salary
FROM salesperson
SAMPLE FIRST 50 ROWS;
SALARY
-----------
175500.00
137000.10
136000.00
138000.40
75000.00
90000.00
...
--- 50 row(s) selected.










