Mysql (4) Data Table query operations bitsCN.com
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 results LIMIT count -- result LIMIT 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 Command: group by col_name... function: GROUP 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. BitsCN.com
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