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

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.

主站蜘蛛池模板: 满城县| 深泽县| 宿州市| 德保县| 五指山市| 民勤县| 东乡族自治县| 沈阳市| 临洮县| 淮阳县| 游戏| 定结县| 沅江市| 绥中县| 宜兰市| 潜江市| 关岭| 岳西县| 措美县| 桃园市| 厦门市| 马龙县| 藁城市| 黄大仙区| 彭州市| 卢龙县| 开原市| 池州市| 汝阳县| 稻城县| 玛纳斯县| 安平县| 宜兴市| 开原市| 读书| 响水县| 宜春市| 高安市| 黄平县| 大关县| 莎车县|