B Table Data Definition Language Overview

Before you can write data to tables in the store, you must provide a definition of the tables you want to use. This definition includes information such as the table's name, the name of its various rows and the data type contained in those rows, identification of the primary and (optional) shard keys, and so forth. To perform these definitions, Oracle NoSQL Database provides a Data Definition Language (DDL) that you use to form table and index statements. These statements can be used to:

  • Define tables and sub-tables.

  • Modify table definitions.

  • Delete table definitions.

  • Define indexes.

  • Delete index definitions.

  • Set and modify default Time-to-Live values for tables.

Table and index statements take the form of ordinary strings, which are then transmitted to the Oracle NoSQL Database store using the appropriate method or function. For example, to define a simple user table, the table statement might look like this:

CREATE TABLE Users (
    id INTEGER,
    firstName STRING,
    lastName STRING,
    contactInfo JSON,
    PRIMARY KEY (id)
) 

For information on how to transmit these statements to the store, see Introducing Oracle NoSQL Database Tables and Indexes.

For overview information on primary and shard keys, see Primary and Shard Key Design.

For overview information on indexes, see Creating Indexes.

The remainder of this appendix describes in detail the DDL statements that you use to manipulate table and index definitions in the store.