In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the basic operation of MySQL query. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
one。 The basic operation of query statement 1. Basic operation of query statement-select-from-where: constraints-group by: grouping-having: filtering-distinct: deduplicating-order by: sorting-limit: limiting the number of query records-aggregate function: count (count) max (maximum) Min (minimum) avg (average) sum (summation) II. Single table query 1, previous table and data preparation # create a department table create table emp (id int not null unique auto_increment, name varchar (20) not null, sex enum ('male','female') not null default' male', # mostly male age int (3) unsigned not null default 28, hire_date date not null, post varchar (50), post_comment varchar (100), salary double (15jue 2), office int # one room per department (depart_id int) # insert record # three departments: teaching, sales Operate insert into emp (name,sex,age,hire_date,post,salary,office,depart_id) values ('tank','male',17,'20170301',' Zhang Jiang first Shuai Image endorsement Department', 7300.33 Magi 401), # below is the Teaching Department ('egon','male',78,'20150302','teacher',1000000.31,401,1), (' kevin','male',81,'20130305','teacher',8300,401,1), ('jason','male',73,'20140701') 'teacher',3500,401,1), (' owen','male',28,'20121101','teacher',2100,401,1), ('jerry','female',18,'20110211','teacher',9000,401,1), (' big cake', 'male',18,'19000301','teacher',30000,401,1), (' sean','male',48,'20101111','teacher',10000,401,1), ('crooked', 'female',48,'20150311','sale',3000.13,402,2) # the following is the sales department ('Yaya', 'female',38,'20101101','sale',2000.35,402,2), (' Tintin', 'female',18,'20110312','sale',1000.37,402,2), (' Xing', 'female',18,'20160513','sale',3000.29,402,2), (' GE', 'female',28,'20170127','sale',4000.33,402,2), (' Zhangye', 'male',28,'20160311','operation'' 10000.13 male',18,'19970312','operation',20000,403,3 403), the following are the operating departments ('Cheng Yaojin', 'male',18,'19970312','operation',20000,403,3), (' Cheng Jiaoyin', 'female',18,'20130311','operation',19000,403,3), (' Cheng Jie Tong', 'male',18,'20150411','operation',18000,403,3), (' Cheng Jie tie', 'female',18,'20140512','operation',17000,403,3) # PS: if Chinese characters are inserted in the windows system, the result of select is blank. You can set all character codes to gbk- select * from emp; #. If there is too much data and it is messy, you can put +\ G-select * from emp\ G-select * from emp at the back of the table. # if there is too much data and messy, you can add\ G-select * from emp\ G at the back of the table. Emphasis: writing SQL statements must follow two points:-Writing order: # get two records with id 4 and 5 select * from emp where id > 3 and id
< 6; - select - from - where - 执行顺序: 比如: 图书管理员,得先找到是哪一个图书馆(哪张表), 再找这本书在图书馆的哪个位置(哪一条记录), 最后查找这个本书中某一页(哪些字段值); select * from emp where id >3 and id
< 6; - from --->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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.