Phoenix Example

About this task

In this example, you will use Phoenix to create a STOCK_SYMBOL table, load data into the table, and then query the table.

SQLLine must be running to complete the steps in this example. To try out Phoenix, complete the following steps:

Procedure

  1. At the 0: jdbc:phoenix:<hostname>:<port> prompt, issue the following SQL statement to drop the table STOCK_SYMBOL:
    DROP TABLE STOCK_SYMBOL;
  2. Create a table named STOCK_SYMBOL with two columns, SYMBOL and COMPANY.
    CREATE TABLE STOCK_SYMBOL (SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);
  3. Insert data into the STOCK_SYMBOL table.
    UPSERT INTO STOCK_SYMBOL VALUES ('Hadoop','MapR');
  4. Query the STOCK_SYMBOL table.
    SELECT * FROM STOCK_SYMBOL;
    +------------+------------+
    |   SYMBOL   |  COMPANY   |
    +------------+------------+
    | Hadoop     | MapR       |
    +------------+------------+
    1 row selected (0.098 seconds)