@@ -801,3 +801,161 @@ statements.
801
801
However, tables are the only object that can be truncated currently, and the `TABLE` keyword can be omitted.
802
802
803
803
Truncating a table permanently removes all existing data from the table, but without removing the table itself.
804
+
805
+ [[comment-statement]]
806
+ == COMMENT ON
807
+
808
+ The `COMMENT ON` statement allows you to add descriptive comments to schema elements for documentation purposes.
809
+ Comments are stored in the schema metadata and displayed when using `DESCRIBE` statements.
810
+
811
+ === COMMENT ON KEYSPACE
812
+
813
+ Add or modify a comment on a keyspace:
814
+
815
+ [source,cql]
816
+ ----
817
+ COMMENT ON KEYSPACE keyspace_name IS 'comment text';
818
+ COMMENT ON KEYSPACE keyspace_name IS NULL; -- Remove comment
819
+ ----
820
+
821
+ Example:
822
+
823
+ [source,cql]
824
+ ----
825
+ COMMENT ON KEYSPACE cycling IS 'Keyspace for cycling application data';
826
+ ----
827
+
828
+ === COMMENT ON TABLE
829
+
830
+ Add or modify a comment on a table:
831
+
832
+ [source,cql]
833
+ ----
834
+ COMMENT ON TABLE [keyspace_name.]table_name IS 'comment text';
835
+ COMMENT ON TABLE [keyspace_name.]table_name IS NULL; -- Remove comment
836
+ ----
837
+
838
+ Example:
839
+
840
+ [source,cql]
841
+ ----
842
+ COMMENT ON TABLE cycling.cyclist_name IS 'Table storing cyclist names and basic information';
843
+ ----
844
+
845
+ === COMMENT ON COLUMN
846
+
847
+ Add or modify a comment on a column:
848
+
849
+ [source,cql]
850
+ ----
851
+ COMMENT ON COLUMN [keyspace_name.]table_name.column_name IS 'comment text';
852
+ COMMENT ON COLUMN [keyspace_name.]table_name.column_name IS NULL; -- Remove comment
853
+ ----
854
+
855
+ Example:
856
+
857
+ [source,cql]
858
+ ----
859
+ COMMENT ON COLUMN cycling.cyclist_name.id IS 'Unique identifier for each cyclist';
860
+ ----
861
+
862
+ === COMMENT ON TYPE
863
+
864
+ Add or modify a comment on a user-defined type:
865
+
866
+ [source,cql]
867
+ ----
868
+ COMMENT ON TYPE [keyspace_name.]type_name IS 'comment text';
869
+ COMMENT ON TYPE [keyspace_name.]type_name IS NULL; -- Remove comment
870
+ ----
871
+
872
+ Example:
873
+
874
+ [source,cql]
875
+ ----
876
+ COMMENT ON TYPE cycling.address IS 'User-defined type for storing address information';
877
+ ----
878
+
879
+ NOTE: Comments can be removed by setting them to `NULL`. Comments are displayed when using `DESCRIBE` statements
880
+ and are useful for documenting the purpose and structure of your schema elements.
881
+
882
+ [[security-label-statement]]
883
+ == SECURITY LABEL ON
884
+
885
+ The `SECURITY LABEL ON` statement allows you to add security classification labels to schema elements.
886
+ Security labels are stored in the schema metadata and displayed when using `DESCRIBE` statements.
887
+ These labels can be used to mark data sensitivity levels or compliance requirements.
888
+
889
+ === SECURITY LABEL ON KEYSPACE
890
+
891
+ Add or modify a security label on a keyspace:
892
+
893
+ [source,cql]
894
+ ----
895
+ SECURITY LABEL ON KEYSPACE keyspace_name IS 'label';
896
+ SECURITY LABEL ON KEYSPACE keyspace_name IS NULL; -- Remove label
897
+ ----
898
+
899
+ Example:
900
+
901
+ [source,cql]
902
+ ----
903
+ SECURITY LABEL ON KEYSPACE cycling IS 'CONFIDENTIAL';
904
+ ----
905
+
906
+ === SECURITY LABEL ON TABLE
907
+
908
+ Add or modify a security label on a table:
909
+
910
+ [source,cql]
911
+ ----
912
+ SECURITY LABEL ON TABLE [keyspace_name.]table_name IS 'label';
913
+ SECURITY LABEL ON TABLE [keyspace_name.]table_name IS NULL; -- Remove label
914
+ ----
915
+
916
+ Example:
917
+
918
+ [source,cql]
919
+ ----
920
+ SECURITY LABEL ON TABLE cycling.cyclist_name IS 'PII';
921
+ ----
922
+
923
+ === SECURITY LABEL ON COLUMN
924
+
925
+ Add or modify a security label on a column:
926
+
927
+ [source,cql]
928
+ ----
929
+ SECURITY LABEL ON COLUMN [keyspace_name.]table_name.column_name IS 'label';
930
+ SECURITY LABEL ON COLUMN [keyspace_name.]table_name.column_name IS NULL; -- Remove label
931
+ ----
932
+
933
+ Example:
934
+
935
+ [source,cql]
936
+ ----
937
+ SECURITY LABEL ON COLUMN cycling.cyclist_name.email IS 'PII-EMAIL';
938
+ ----
939
+
940
+ === SECURITY LABEL ON TYPE
941
+
942
+ Add or modify a security label on a user-defined type:
943
+
944
+ [source,cql]
945
+ ----
946
+ SECURITY LABEL ON TYPE [keyspace_name.]type_name IS 'label';
947
+ SECURITY LABEL ON TYPE [keyspace_name.]type_name IS NULL; -- Remove label
948
+ ----
949
+
950
+ Example:
951
+
952
+ [source,cql]
953
+ ----
954
+ SECURITY LABEL ON TYPE cycling.address IS 'SENSITIVE';
955
+ ----
956
+
957
+ NOTE: Security labels can be removed by setting them to `NULL`. Security labels are displayed when using `DESCRIBE` statements
958
+ and can be used in conjunction with custom authorization plugins or audit systems to enforce data access policies.
959
+
960
+ IMPORTANT: `COMMENT ON` and `SECURITY LABEL ON` statements require schema version V8 or higher.
961
+ Ensure all nodes in your cluster support this version before using these features.
0 commit comments