Documentation Home
MySQL Cluster API Developer Guide
Download this Manual
PDF (US Ltr) - 5.0Mb
PDF (A4) - 4.9Mb
EPUB - 1.9Mb
HTML Download (TGZ) - 1.9Mb
HTML Download (Zip) - 1.9Mb


4.2.2.2 Creating tables

ClusterJ's main purpose is to read, write, and update row data in an existing database, rather than to perform DDL. You can create the employee table that matches this interface, using the following CREATE TABLE statement, in a MySQL client application such as mysql.

CREATE TABLE employee (
    id INT NOT NULL PRIMARY KEY,
    first VARCHAR(64) DEFAULT NULL,
    last VARCHAR(64) DEFAULT NULL,
    municipality VARCHAR(64) DEFAULT NULL,
    started DATE DEFAULT NULL,
    ended DATE DEFAULT NULL,
    department INT NOT NULL DEFAULT 1,
    UNIQUE KEY idx_u_hash (last,first USING HASH,
    KEY idx_municipality (municipality)
) ENGINE=NDBCLUSTER;

Now that the table has been created in MySQL Cluster, you can map a ClusterJ interface to it using annotations. We show you how to do this in the next section.


User Comments
Sign Up Login You must be logged in to post a comment.