Database Reference
In-Depth Information
3.
Let's create secondary index over fullname
create index fullname_idx on users(fullname);
After successful index creation, we can fetch records using fullname.
Figure 2-12 shows the result.
Figure 2-12 . Search user for records having fullname value vivekm
4.
Let's add a column of age and create the index:
alter table users add age text;
create index age_idx on users(age);
update users set age='32' where
user_id='imvivek';
insert into
users(user_id,email,password,fullname,followers,age)
values
('mkundera',' mkundera@outlook.com ','password','milan
kundera',{'imvivek':'vivekm','guest':
'guestuser'},'51');
Figure 2-13 shows the outcome.
Figure 2-13 . Selecting all users of age 51
5.
Let's alter data type of age to int :
alter table users alter age type int;
It will result in the following error:
 
 
 
 
Search WWH ::




Custom Search