从数据库导出数据
需进入mysql\bin目录下执行
mysqldump --single-transactio --quick --default-character-set=utf8 -ubi_root -P3306 -hlocalhost -pmanagerroot%@! incrmentbak job > job_028.sql
mysqldump --single-transactio --quick --default-character-set=utf8 -uroot -P3306 -hlocalhost -p incrmentbak job_profession_info > job_profession_info_028.sql
数据库导入
use incrmentbak;
set names 'utf8'
set autocommit=0
source 文件名
truncate table xxname删表内容
修改时间戳? ALTER TABLE statistic_corp_totalize_day MODIFY ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
SELECT * FROM profession_info_num WHERE num > 1 ORDER BY num DESC;
CREATE TABLE profession_info_num_abs AS
SELECT p1.job_title job_title, p1.profession_type_id profession_type_id,
ABS(p2.max_num - p1.num) result
FROM profession_info_num p1, profession_info_num_max p2
WHERE p2.job_title = p1.job_title
HAVING result = 0;
创建表
CREATE TABLE profession_info AS
SELECT p.id_level2 level1, p.id_level2_name level1_name, p.id_level1 level2, p.id_level1_name level2_name,
p.node_id profession_type_id, p.function_name profession_type, j.job_title job_title
FROM company_detail c,job j,job_profession_type_company_id jptci,profession_type_dim p
WHERE p.node_id = jptci.profession_type AND jptci.job_id = j.id AND c.id = jptci.company_id
ORDER BY jptci.profession_type;
CREATE TABLE job_profession_info AS
SELECT p.id_level2 level1, p.id_level2_name level1_name, p.id_level1 level2, p.id_level1_name level2_name,
p.node_id profession_type_id, p.function_name profession_type, j.job_title job_title
FROM company_detail c,job j,job_profession_type_company_id jptci,profession_type_dim p
WHERE 2>3;
插入数据
INSERT INTO job_profession_info(level1,level1_name,level2,level2_name,profession_type_id,profession_type,job_title)
SELECT level1,level1_name,level2,level2_name,profession_type_id,profession_type,job_title
FROM profession_info