-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01-create-script.sql
More file actions
27 lines (23 loc) · 865 Bytes
/
Copy path01-create-script.sql
File metadata and controls
27 lines (23 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- Fix the following Cassandra DDL, so that all queries from the files below can be executed without changes
-- 02-upsert-readonly.sql and
-- 03-query-readonly.sql
-- Create keyspace (press TAB for autocomplete in cqlsh)
CREATE KEYSPACE homework WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 3};
-- Use keyspace
USE homework;
-- Fix the following table creation script so that the subsequent queries work as expected
-- The table contains both the invoice header and the invoice detail fields
CREATE table invoice
(
-- header fields
invoice_id text,
invoice_date date static,
invoice_address text static,
-- detail fields
line_id int,
article_name text,
article_price decimal,
PRIMARY KEY (invoice_id, article_name)
);
-- WITH CLUSTERING ORDER BY (line_id ASC, article_name ASC);
CREATE INDEX ON invoice(invoice_date);