Statistics

--1. Store your own captured data into
sanya_result_test_all (total data) with the same structure as your own table,
sanya_result_test_new (new data),
sanya_result_test_old (duplicate data)

-- run the java program of the importance class, according to mer_name (store name) and NM_SHOP (shop_name) for similarity comparison --determine duplicate data and new data; import them into the sanya_result_test_new
and sanya_result_test_old tables respectively

--1.
ENT_NAME for comparison,
-- if the shop exists in the NM_SITE_ENT table, you do not need to insert data into NM_SITE_ENT, take out the corresponding site_ent_id, and insert a piece of data into the nm_shop table,
--shop_id (automatically generated), site_ent_id, platform_code( platform), SHOP_NAME (shop name), SHOP_ADDRESS (shop address), Shop_URL (shop URL), SHOP_CONTENT (shop content), HPL (overall rating), EV_NUM (total number of reviews), ADD_TIME (current entry time), LASTDATE (current time), BAD_EV_NUM (total number of bad reviews), IS_EV (whether or not to evaluate, the default is 0)

--2. If the store does not exist in NM_SITE_ENT
-- first generate a site_ent_id,
-- insert a piece of data into NM_SITE_ENT
--ENT_NAME (subject name, store name), IS_ILLEGAL (legal or not, default is 0), ADD_TIME (add date defaults to current), AREA (area to which the website belongs: 100 Sanya, 101 Lingshui, 102 Baoting, 103 Ledong), MANAGER_ILLEGAL (determination result defaults to 0), EST_DATE (establishment date), ZT_ADDRESS (address), REGISTERED_CAPITA (registered capital), LEGAL_REPRESENTATIVE (legal representative), ENTERPRISE_TYPE (enterprise type), BUSINESS_SCOPE (business scope), IS_ZT (status added as 2)
--Add a piece of data to nm_shop site_ent_id is the site_ent_id just inserted into NM_SITE_ENT, shop_id is automatically generated --query

platform
select * from PUB_CODETABLE where codetable='sjly' --Add

two platforms of China Universal Network and Youzai Travel Network .

--3. If you insert data next time, first update the IS_ZT of 2 in NM_SITE_ENT to 0 (is_zt field mark 2 means new) --The meaning
of IS_ZT field in NM_SITE_ENT table: 2 is new, 1 is old , 0 does not exist

-- modify the current time statement
update nm_site_ent t set t.add_time =sysdate where t.is_zt =2;



--2016-7-27

--(new data inserted in nm_shop table)
SELECT * FROM nm_shop t WHERE 1=1 AND to_char(add_time,'YYYY-MM-DD HH12:MI:SS') like '%2016-07-27 11:43:00%'; --Import 
statement

--same A database, the same table structure to import data
INSERT INTO nm_site_ent2 (SELECT * FROM nm_site_ent); --create

the same table
create table table_name1 as select * from table_name2

--1. You can import data by exporting the .dmp file

--2. Also Note code can be exported and imported through excel, the cell is set to text type, the association table NM_SHOP_TYPE()
1 Hotel 100 1001
2 Food 106 10602
3 Vacation 104 10406
​​4 Wedding photography 107 107
5 Car rental 105 10501
6 Group tour 104 10401
7 Attractions Tickets 109 109 --Query

Category
select * from pub_codetable where codetable='big'


------------------------ --Note
: 1 defaults to c:/ user/administer)
--exp sywj/sywj@ORCL file=nm_shop_good.dmp tables=(nm_shop_good) --Import

four tables
nm_shop shop table

nm_site_ent main table

nm_shop_type shop classification table

nm_evaluation comment table

-- associated query sub-table count
-- stage statistics sql
select a.shop_id as shop ID, a.shop_name as shop name,
a.platform_code as platform ID, a.shop_address as shop address, a.shop_url as url,
a.ev_num as total number of reviews, a.bad_ev_num as total number of bad reviews,
(select count(1) from z_nm_evaluation_totle6789 b where b.shop_id=a.shop_id and (substr(b.ev_time, 6, 1)='8' or substr(b.ev_time, 6, 1)='6') ) as Ah the total number of comments from June to July,
(select count(1) from z_nm_evaluation_totle6789 b where b.shop_id=a.shop_id and b.is_bad='1' and (substr(b.ev_time, 6, 1)='8 ' or substr(b.ev_time, 6, 1)='7')) as ah, the difference in the number of comments from June to July,
(select count(1) from z_nm_evaluation_totle6789 b where b.shop_id=a.shop_id and (substr(b.ev_time, 6, 1)='8' or substr(b.ev_time, 6, 1)='9') ) as 啊8到9月总评论数,
(select count(1) from z_nm_evaluation_totle6789 b where b.shop_id=a.shop_id and b.is_bad='1' and (substr(b.ev_time, 6, 1)='8' or substr(b.ev_time, 6, 1)='9')) as 啊8到9月差评论数
from a_nm_shop_8_9 a


--截取日期
update a_nm_evaluation_8_9_kai_tm_2 set ev_time=replace(ev_time,substr(ev_time,8,1),'') where ev_time like '_______0%'



Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326571111&siteId=291194637