Creating the users table

Our first table will store basic user account information: username, email, and password. To create the table, fire up the CQL shell (don't forget to use the USE  my_status; statement if you are starting a fresh session) and enter the following CQL statement:

    CREATE TABLE "users" (       "username" text PRIMARY KEY,       "email" text,       "encrypted_password" blob     );

In the preceding statement, we created a new table called users, which has three columns: username and email, which are the text columns, and encrypted_password, which has the type blob. The username column acts as the primary key for the table.

Another way to declare this table is as follows:

    CREATE TABLE "my_status"."users" (     "username" text, "email" text, ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.