How to create user defined data type (UDT)....

cqlsh:ks> // UDT can be created as part of keyspace
cqlsh:ks> create type mark (
      ...    math text,
      ...    science text
      ... );
cqlsh:ks>
cqlsh:ks> // UDT can be utilized by using the 'frozen' keyword #74
cqlsh:ks> // Note : The concept of 'frozen' is given for forward
cqlsh:ks> //        compatibility
cqlsh:ks> create table student(
      ...    name text,
      ...    class text,
      ...    subjects frozen<mark>,
      ...    primary key(name));
cqlsh:ks>
cqlsh:ks> insert into student(name, class, subjects) values('bob', '3rd',
      ...    {math: '70', science: '80'});
cqlsh:ks> select * from student;

 name | class | subjects
------+-------+-----------------------------
  bob |   3rd | {math: '70', science: '80'}

(1 rows)

No comments:

Post a Comment