Some commonly used MySQL command to collect and organize

Source: Internet
Author: User
Keywords Network programming Mysql tutorial
Tags command line create data data tables display help learn mysql

MySQL command line is to learn the MySQL database must master the knowledge, here is to introduce you to 10 easy-to-use MySQL command line, I hope you learn MySQL command line can help.

1, show the structure of the data table:

mysql> DESCRIBE table name; (DESC table name)

2, the establishment of data tables:

mysql> USE library name; / / Enter the database

mysql> CREATE TABLE table name (field name VARCHAR (20), field name CHAR (1));

3, delete the data sheet:

mysql> DROP TABLE table name;

4, rename the data table

alter table t1 rename t2;

5, show the record in the table:

mysql> SELECT * FROM table name;

6, insert records to the table:

mysql> INSERT INTO table name VALUES ("hyq", "M");

7, update the data in the table:

mysql-> UPDATE table name SET field name 1 = 'a', field name 2 = 'b' WHERE field name 3 = 'c';

8, empty the records in the table:

mysql> DELETE FROM table name;

9, the text data into the data table:

mysql> LOAD DATA LOCAL INFILE "D: / mysql.txt" INTO TABLE table name;

10, display the definition of the table, you can also see the constraints of the table, such as foreign keys

The above is the introduction of 10 commonly used MySQL command line.

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.