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

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.

主站蜘蛛池模板: 南皮县| 灌云县| 关岭| 闵行区| 仙桃市| 蓬溪县| 榆中县| 石渠县| 龙州县| 米易县| 上高县| 唐河县| 巩义市| 灵宝市| 三明市| 社会| 门头沟区| 长葛市| 当涂县| 定襄县| 灵丘县| 和平县| 资溪县| 巴青县| 榕江县| 额尔古纳市| 锦州市| 开远市| 寿阳县| 上饶县| 陆川县| 托克托县| 吴桥县| 太湖县| 邵东县| 遵义县| 梅河口市| 汝南县| 平顶山市| 丘北县| 三原县|