Commands in 13-mysql

Source: Internet
Author: User

1. delete a table: Drop table name;

2. Insert record: insert into user (ID, name) values (1, 'zhang san ');

3. Delete record: delete from user where id = 1;

4. Modify the record: update user set name = 'lily' where id = 1;

5. query record: Select * from user;

6. query the table structure: DESC user;

7. query the database: Show databases;

8. query tables in the database: show tables;

9. Use the database: Use test;

10. Paging query: Select * from user limit 0, 10;

11. fuzzy query: Select * from user where name like '% ABC % ';

12. query the database encoding: Show variables like '% char % ';

13. Set the encoding method: Set names GBK;

14. You can also set: Show variables like '% char % ';

15. table self-duplication: insert into user (name) Select name from user; // the data of the copied table is: Y = A1 * 2 ^ N; Y indicates that the number of results A1 is the first, and N indicates 0, 1, 2...

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.