官术网_书友最值得收藏!

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,
"encrypted_password" blob,
primary key (username)
);

Later, we will learn that the second way of declaring tables is often the only way.

主站蜘蛛池模板: 文水县| 洱源县| 永福县| 榆社县| 扬州市| 海宁市| 乌拉特中旗| 崇文区| 阿图什市| 武定县| 华容县| 闻喜县| 永泰县| 凤庆县| 额济纳旗| 汶川县| 连南| 屯留县| 泰兴市| 双辽市| 阳高县| 康平县| 彰武县| 东平县| 青岛市| 双桥区| 治多县| 和静县| 库尔勒市| 喜德县| 陕西省| 乃东县| 淅川县| 庆元县| 根河市| 五华县| 枝江市| 邵东县| 栾川县| 黄山市| 徐水县|