Mysql record copy Import and Export

Source: Internet
Author: User


Mysql record copy Import and Export copy record lower case-insensitive function password encryption function www.2cto.com create table employee> create table employee (id int, name char (10), agi int, sex enum ('M', 'F'), department char (10);> insert into employee values (23, 'john', 27, 'M ', 'engi'), (31, 'sue ', 31, 'F', 'fiance'), (113, 'David', 26, 'M ', 'admin');> select * from employee; + ------ + ------- + ------ + ------------ + | id | name | agi | sex | department | + ------ + ------- + ------ + ------------ + | 23 | john | 27 | M | Engi | 31 | Sue | 31 | F | Fiance | 113 | David | 26 | M | Admin | + ------ + ------- + ------ + ------------ + create table user> create table user (uid int primary key auto_increment, uname char (10), upass char (10); copy record> insert into user (uname, upass) select lower (name), password (lower (name )) from employee;> select * from user; + ----- + ------- + ------------ + | uid | uname | upass | + ----- + ------- + ------------ + | 1 | john | * DACDE7F57 | 2 | sue | * 934B89788 | 3 | david | * 8201E0C1B | + ----- + ------- + ------------ + when copying a record, you can add the where condition> insert into user (uname, upass) select (name), password (name) from employee where department = 'fiance ';> select * from user; + ----- + ------- + ------------ + | uid | uname | upass | + ----- + ------- + ------------ + | 1 | john | * DACDE7F57 | 2 | sue | * 934B89788 | 3 | david | * 8201E0C1B | 4 | Sue | * 287E48EAA | + ----- + ------- + ------------ + ------------------------ www.2cto.com import data load data infile... syntax: load data infile' absolute path of the file 'into table name fields terminated by 'field delimiter 'Lines terminated by' record delimiter'; example:> load data infile '/tmp/a.txt' into table t20 fields terminated by ': 'Lines terminated by' \ n'; export data select... into outfile... syntax: select field from table name into outfile' file absolute path 'fields terminated by' Field Segmentation server 'Lines terminated by' record delimiters '; example:> select * from t20 into outfile '/tmp/B .txt' fields terminated by ': 'Lines terminated by' \ n ';

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.