In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Single table query: SELECT [DISTINCT] [SQL_CACHE | SQL_NO_CACHE] select_expr [, select_expr...] [FROM table_references [WHERE where_condition] [GROUP BY {col_name | expr |}] [HAVING where_condition] [ORDER BY [ASC | DESC]] DISTINCT: data deduplication SQL_CACHE: specify cache SQL_NO_CACHE: specify cache WHERE clause: specify condition Filter condition: arithmetic operation: +-* /% >
< >= CREATE DATABASE mydb; # create test database mysql > USE mydb; mysql > CREATE TABLE test (id int (50), name varchar (50), qq int (15), gender char (2); # create test table mysql > INSERT INTO test VALUES Mysql > INSERT INTO test VALUES; mysql > SELECT * FROM test WHERE id > 2 AND id SELECT * FROM test WHERE id > 2 GROUP BY gender; # grouping by gender mysql > SELECT sum (id), gender FROM test GROUP BY gender # grouping gender and asking for the sum of their id mysql > SELECT * FROM test GROUP BY gender HAVING id > 2; # grouping gender to show that the group with id greater than 2 has a multi-table association query: mysql > CREATE TABLE test2 (emain varchar (200), age int (10)); # create a test environment mysql > INSERT INTO test2 values ('123 roomqq.composition10) Mysql > INSERT INTO test2 values ('456 roomqq.compositional Magna 15); mysql > INSERT INTO test2 values (' 789 roomqq.compositional Magnesia 20); mysql > SELECT test.id,test2.age FROM test,test2 WHERE test.id > 2 AND test2.age > 10 Test.id # Chapter I Table id Field test2.age # Chapter II Table age Field test # Chapter I Table name test2 # Chapter II Table name test.id > 2 AND test2.age # splice display test's id field and test2's age field But the id field of test must be greater than 2 and the age field of test2 must be greater than 10 mysql > SELECT * FROM test,test2 WHERE test.id > 2 AND test2.age > 10 # splicing shows all fields of test,test2, but the id field of test must be greater than 2 and the age field of test2 must be greater than 10
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.