Using an Apache® Cassandra® database C++ interface, create a Cassandra® database connection and execute a CQL query to import data from a Cassandra database table into MATLAB®. In this case, the Cassandra database contains the employees_by_job database table with employee data in the employeedata keyspace.
Create a Cassandra database connection using the configured data source CassandraDataSource and a blank user name and password. The apacheCassandra function returns conn as a connection object.
Write a CQL query that selects all employees who are programmers or shop clerks hired before April 30, 2006, and retrieves their job identifiers, hire dates, and email addresses. job_id is the partition key of the employees_by_job database table, and hire_date is a clustering column.
Execute the CQL query and display the first few rows of results.
ans=8×3 table
job_id hire_date email
__________ ___________ __________
"IT_PROG" 05-Feb-2006 "VPATABAL"
"IT_PROG" 03-Jan-2006 "AHUNOLD"
"IT_PROG" 25-Jun-2005 "DAUSTIN"
"SH_CLERK" 24-Apr-2006 "AWALSH"
"SH_CLERK" 23-Feb-2006 "JFLEAUR"
"SH_CLERK" 24-Jan-2006 "WTAYLOR"
"SH_CLERK" 13-Aug-2005 "JDILLY"
"SH_CLERK" 14-Jun-2005 "KCHUNG"
results is a table with the job_id, hire_date, and email variables. The hire_date variable is a datetime array and the job_id and email variables are string arrays.
Close the Cassandra database connection.