SQL/MX Quick Start (G06.24+, H06.03+)
Selecting Information From a Table
HP NonStop SQL/MX Quick Start—523724-002
2-5
Selecting Distinct Rows
Example
Display the column definitions of the PARTS table:
INVOKE PARTS;
The displayed column definitions are:
-- Definition of table SAMDBCAT.SALES.PARTS
-- Definition current Thu Jul 10 15:03:29 2003
 (
 PARTNUM NUMERIC(4, 0) UNSIGNED NO DEFAULT 
 HEADING 'Part/Num' NOT NULL NOT DROPPABLE 
 , PARTDESC CHAR(18) CHARACTER SET ISO88591 COLLATE 
 DEFAULT NO DEFAULT 
 HEADING 'Part Description' NOT NULL NOT DROPPABLE 
 , PRICE NUMERIC(8, 2) NO DEFAULT 
 HEADING 'Price' NOT NULL NOT DROPPABLE 
 , QTY_AVAILABLE NUMERIC(5, 0) DEFAULT 0 
 HEADING 'Qty/Avail' NOT NULL NOT DROPPABLE 
 )
Tip
•
The PARTDESC column contains character data. The maximum number of 
characters you can enter in the column is 18. You must enclose the characters in 
single quotation marks.
•
The columns other than PARTDESC contain numeric data. PARTNUM can contain 
at most 4 digits and cannot have a plus or minus sign. PRICE can contain at most 
8 digits, including 2 digits to the right of the decimal point. QTY_AVAILABLE can 
contain at most 5 digits.
•
NO DEFAULT means an INSERT statement must specify a value for the column. 
DEFAULT 0 means that an INSERT statement can omit a value for the column 
because the system will assign the 0 (zero) as the default value. 
•
All of the columns have been defined with NOT NULL, which means that the 
columns cannot accept null values at any time. For a description of the INSERT 
statement, see Inserting a Row Into a Table on page 6-1.
Selecting Distinct Rows
In some cases, a value in the select list appears more than once in your result. For 
example, a sales representative typically has several orders in the ORDERS table. The 
keyword DISTINCT eliminates duplicates from your result.










