Creating a table
Steps for creating a table with a single primary key.
Tables can have single and compound primary keys. To create a table having a single primary key, use the PRIMARY KEY keywords followed by the name of the key, enclosed in parentheses.
- Create and use the keyspace in the last example if you haven't already done so.
users table in the demodb keyspace, making the user name the primary key.
CREATE TABLE users ( user_name varchar, password varchar, gender varchar, session_token varchar, state varchar, birth_year bigint, PRIMARY KEY (user_name));