postgresql - How to change JSON text of MySql database to JSON datatype of postgres sql -
how change json text of mysql database json datatype of postgres sql.i storing json data in database table of mysql , want convert json datatype of postgres sql
mysql create table
create table if not exists `employee` ( `id` bigint(40) not null auto_increment, `employee_id` bigint(40) not null, `employee_info` text not null, )
in employee_info storing {"employee_name":"abc","address":"1","emloyee_weight":"30","age":"100","phone":"9845236775"} in mysql database json .
and wanted convert json datatype of postgressql
question shouldn't left unanswered :-)
it's pretty simple:
postgresql create table
create table employee ( id bigserial primary key, employee_id bigint not null, employee_info json not null );
and can magic like:
select * employee employee_info->>'address' '%kr%';
or
select * employee cast(employee_info->>'emloyee_weight' integer)>30;
heed on postgres version, should 9.3 or greater
Comments
Post a Comment