CREATE KEYSPACE library WITH REPLICATION ={'class':'SimpleStrategy','replication_factor':1};
USE library;
-- Create a table for authors
CREATE TABLE authors (
author_id uuid PRIMARY KEY,
firstname varchar,
lastname varchar,
email varchar
);
-- Insert an author
INSERT INTO authors (author_id, firstname, lastname, email) VALUES (uuid(),'Jane','Austen','janeausten@gmail.com');
-- Drop the email column
ALTER TABLE authors DROP email;
-- Add a new column 'age'
ALTER TABLE authors ADD age int;
-- Insert another author with the new age column
INSERT INTO authors (author_id, firstname, lastname, age) VALUES (uuid(),'Mark','Twain',45);
-- Create a table for books
CREATE TABLE books (
book_id uuid PRIMARY KEY,
title varchar,
author_id uuid,
publication_date date
);
-- Insert a book
INSERT INTO books (book_id, title, author_id, publication_date) VALUES (uuid(),'Pride and Prejudice',(SELECT author_id FROM authors WHERE firstname='Jane' AND lastname='Austen'),'1813-01-28');
Error: near line 2: near "KEYSPACE": syntax error
Error: near line 3: near "USE": syntax error
Error: near line 14: no such function: uuid
Error: near line 17: near "DROP": syntax error
Error: near line 23: no such function: uuid
Error: near line 34: no such function: uuid