MySQL Common basic operation Syntax (iv)--simple unconditional query on data and library and table query "command line mode"

Source: Internet
Author: User
1, MySQL simple query: Select field 1, Field 2 ... from TableName;

If a field writes A *, which represents all fields of the query, it is equivalent to specifying all the field names, so if you want to query data for all fields, it is generally used *.
2, go to re-query: SELECT DISTINCT field 1, Field 2 ... form tablename;

Can be compared with the results of the previous picture.
3, directly in the query to do mathematical arithmetic, subtraction Yu:

4. Rename the query result field when querying; Select field 1 as Name 1, field 2 as Name 2 ... from TableName;

Here the as rename is used, in fact as can be omitted without writing:

5. Use the Concat connection string to get a custom formatted query result:

6, suddenly think of the library and the table before the deletion and change operation but missed the operation of the query, here: Query all the database show databases; query all tables under the current database show tables;


MySQL Common basic operation Syntax (iv)--simple unconditional query on data and library and table query "command line mode"

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.