The most effective method to Create Table in Cassandra
Segment family in Cassandra is like RDBMS table. Segment family is utilized to store information.
Order 'Make Table' is utilized to make section family in Cassandra.
Essential key: There are two sorts of essential key.
Single Primary Key: Single essential key is determined by the accompanying language structure.
Essential key (ColumnName)
In the single essential key, there is just a solitary section. That section is additionally called apportioning key. Information is apportioned based on that section. Information is spread on various hubs based on the segment key.
Compound Primary Key: Compound essential key is determined by the accompanying punctuation.
Essential key(ColumnName1,ColumnName2 . . .)In above punctuation, ColumnName1 is the parceling key and ColumnName2 is the Clustering key. Information will be parceled based on ColumnName1 and information will be grouped based on ColumnName2. Grouping is the cycle that sorts information in the segment.
In above language structure, ColumnName1 and ColumnName2 are the compound segment key. Information will be apportioned based on the two segments ColumnName1 and ColumnName2 and information will be bunched based on the ColumnName3. Assuming you have an excessive amount of information on the single parcel. Then, at that point, compound parceling key is utilized. Compound apportioning key is utilized to make different parcels for the information.
"With proviso" is utilized to determine any property and its incentive for the characterized table. For instance, to pack Cassandra table information. You can set pressure property by determining pressure calculation property estimation in "With provision."Here is the execution of the order 'Make table' that will make table name 'Understudy' in the keyspace 'College.'
Cassandra Create Table
After fruitful execution of the order 'Make table', table 'Understudy' will be made in the keyspace 'College' with segments RollNo, Name and dept. RollNo is the essential key. RollNo is likewise a segment key. Every one of the information will be in the single segment.Cassandra Alter tableOrder 'Modify Table' is utilized to drop section, add another segment, adjust segment name, change section type and change the property of the table.Following is the language structure of order 'Modify Table.'
Adjust ColumnName TYPE ColumnDataype |
Add ColumnName ColumnDataType |
Drop ColumnName |
Rename ColumnName To NewColumnName |
Here is the depiction of the order 'Adjust Table' that will add new segment in the table Student.Cassandra Alter tableAfter effective execution of the order 'Modify Table', another segment 'Semester' with 'int' information type will be added to the table Student.Here is the screen capture that shows the refreshed Student table.Order 'Drop table' drops determined table including every one of the information from the keyspace. Prior to dropping the table, Cassandra takes a preview of the information not the pattern as a reinforcement.
Here is the preview of the executed order 'Drop Table' that will drop table Student from the keyspace 'College'.After effective execution of the order 'Drop Table', table Student will be dropped from the keyspace University.Here is the preview that shows the blunder returned by the Cassandra when attempted to get to Student table that doesn't exist.Order 'Shorten table' eliminates every one of the information from the predefined table. Prior to shortening the information, Cassandra takes the preview of the information as a reinforcement.There are three records in the table Student. These are the records in the table.
Here is the depiction of the executed order 'Shorten table' that will eliminate every one of the information from the table Student.After effective execution of the order 'Shorten Table', every one of the information will be taken out from the table Student.Here is the depiction of the data set state where there are no records in the table Student.
|Hive Query Language Tutorial