MySQL use of SQL statements-170413

Source: Internet
Author: User

1. Insert several fields from table T2 into table T1:

INSERT INTO T1 (t1.c1,..., t1.c5) Select T2.c1,..., t2.c5 from T2;

The time function in 2.MySQL:

Curdate () 2017-04-13

Now () 2017-04-13 09:09:09

3. Replace:

UpdateName of the tableSetthe name of the field to replace for this table=replace (the name of the field to replace for this table, 'Original Content', 'New Content')

4. Intercept the string:

SUBSTR (field name, nth bit start intercept, intercept m bit)

5. Delete:

Delete Records in table: Delete from table tablename where condition ... ;

Delete tables: drop TABLE tablename;

6. Positioning:

LOCATE (string, field name)--locates the position of the string in the data;

7. Find table 1, table 2, field 1 is the same, field 2 different data;

SELECT t1.* from person_lnfo T1 joins Person_lnfo T2 on T1.houseid=t2.houseid and t1.unitid<>t2. Unitid;



MySQL use of SQL statements-170413

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.