Some common MySQL command collection and collation

Source: Internet
Author: User
Tags command line insert mysql table name mysql command line mysql database

MySQL command line is to learn the MySQL database must have knowledge, the following for you to introduce 10 useful MySQL command line, I hope you learn the MySQL command line can help.

1, display the structure of the data table:

mysql> DESCRIBE table name; (DESC table name)

2, the establishment of data tables:

mysql> use library name; Access to the database

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

3, delete the data table:

mysql> DROP table name;

4. Renaming data tables

ALTER TABLE t1 rename T2;

5, display the records in the table:

Mysql> SELECT * from table name;

6. Insert records into 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 record of the table:

Mysql> DELETE from table name;

9. Loading data into the data table by means of text:

mysql> LOAD DATA Local INFILE "d:/mysql.txt" to table name;

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

These are the 10 most common MySQL command lines introduced.




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.