- Learning Apache Cassandra(Second Edition)
- Sandeep Yarabarla
- 143字
- 2021-07-03 00:19:28
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.
推薦閱讀
- 大數據戰爭:人工智能時代不能不說的事
- Hands-On Internet of Things with MQTT
- 計算機圖形學
- 輕松學Java
- CompTIA Network+ Certification Guide
- Nginx高性能Web服務器詳解
- 大數據驅動的機械裝備智能運維理論及應用
- 菜鳥起飛系統安裝與重裝
- PostgreSQL 10 Administration Cookbook
- Chef:Powerful Infrastructure Automation
- Containers in OpenStack
- Working with Linux:Quick Hacks for the Command Line
- INSTANT VMware vCloud Starter
- 運動控制系統(第2版)
- C#編程兵書