Mysql (4) Data Table query operations

Source: Internet
Author: User


Mysql (4) data query operations on Data Tables SELECT statement SELECT select_list1 ,... -- Query which columns FROM select_table -- query FROM which table WHERE primary_constraint -- Query which conditions are met BY the row group by grouping_columns -- How to GROUP the results HAVING secondary_constraint -- the second condition that the row must meet order by sorting_columns -- how to sort the results LIMIT count -- the result is limited to www.2cto.com 1. common query command: SELECT * FROM tbname; function: finds data of all columns FROM the tbname table. 2. query specific line commands: SELECT * FROM tbname WHERE colname = 'value'; function: Find rows with column values equal to 'value' FROM tbname in the table. 3. query specific column commands: SELECT col1, col2 FROM tbname; function: query the two columns col1 and col2 FROM the table. 4. query sorting command: order by column_name [ASC | DESC] [,...] function: Use the oeder by clause to sort the query results BY one or more columns. ASC is sorted in ascending order, which is the default value. DESC is descending. Order by cannot be sorted BY text or image. 5. query GROUP www.2cto.com command: group by col_name... function: grouping Command Based on the given column name: select count (*) FROM tbname; function: COUNT the number of non-NULL results. Use the command: SELECT species, COUNT (*) FROM pet group by species; function: query the number of each pet. 6. run the UPDATE tbname SET command to modify the WHERE condition of the column. For example, UPDATE guestbook SET visitor = 'sunnnyboysac 'WHERE comments = '... '; note: the condition for updating the visitor value to sunnyboysac is comments = '... '. 7. Run the "delete from tbname WHERE" command to DELETE data. For example, delete from guestbook WHERE visitor = 'sunnyboysac '. You can use the "delete from guestbook;" statement to DELETE data FROM the entire table.

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.