- 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.
推薦閱讀
- 計算機原理
- 來吧!帶你玩轉Excel VBA
- 數控銑削(加工中心)編程與加工
- 快學Flash動畫百例
- 智能工業報警系統
- 基于多目標決策的數據挖掘方法評估與應用
- Linux:Powerful Server Administration
- 工業機器人運動仿真編程實踐:基于Android和OpenGL
- 突破,Objective-C開發速學手冊
- 分析力!專業Excel的制作與分析實用法則
- LMMS:A Complete Guide to Dance Music Production Beginner's Guide
- 液壓機智能故障診斷方法集成技術
- 工業機器人實操進階手冊
- 機器人剛柔耦合動力學
- PostgreSQL High Performance Cookbook