MySQL query data

Source: Internet
Author: User
Tags mysql query

Select  from test; +----+--------+| ID | Name   |+----+--------+|  1 | Apple  | |  2 | Banana | |  3 | Cherry | |  4 | Apple  | |  5 | Banana | |  6 | Cherry |+----+--------+
Mysql>Select* fromtest; # query all data mysql>SelectId,name fromtest; # query only data for id,name two fields MySQL>Select* fromTestwhereId=2; # only Query ID is2data for MySQL>Select* fromTestwhereId=1and name='Apple'; # query MySQL with and>Select* fromTestwhereId=1or name='Banana'; # query MySQL with or>Select* fromTestwhereIdinch(1,3); # UseinchQuery, which means that only the query ID is1And3data for MySQL>Select* fromTestwhereID between1and4; # Use Between...and ... Query, which indicates that only the query ID1-4the data between
Mysql> SELECT * FROM test where name is like ' app% '; # using a like query, refer to http://www.cnblogs.com/pzk7788/p/6899748.html
Mysql> SELECT * FROM test order by ID; # to sort the query results, refer to: http://www.cnblogs.com/pzk7788/p/6911594.html
MySQL>SelectId,name fromTest limit2; # query only the previous two data

MySQL query data

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.