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

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.

主站蜘蛛池模板: 富平县| 郎溪县| 潞城市| 寻甸| 芮城县| 福清市| 武汉市| 关岭| 新民市| 贵港市| 陈巴尔虎旗| 通辽市| 将乐县| 仲巴县| 吉木萨尔县| 闵行区| 遂溪县| 景泰县| 九台市| 孝昌县| 新丰县| 大余县| 霞浦县| 沈阳市| 普洱| 蒙自县| 湘阴县| 大冶市| 沁水县| 阜康市| 谷城县| 敦化市| 长治市| 双峰县| 长武县| 淅川县| 库伦旗| 河池市| 双辽市| 兴山县| 灵武市|