mysql table operations

create table test(id  int(10),name  varchar(20),age  int(10))
insert into test values(1,'avc',18)insert into test values(2,'abc',30)insert into test values(3,'abc',40)

maximum

The smallest

Average

Find the number of statistics

Find the id sum

group by having has deduplication function

Next try left connection, right connection, inner connection

Test table data:

Test2 table data:

Left connection sql:

select * from test left join test2 on test.id=test2.id

Result display:

Right connect sql:

select * from test2 right join test on test2.id=test.id

Result display:

Inner connection sql:

select * from test  inner join  test2 on test.id=test2.id;select * from test,test2 where test.id=test2.id

Result display:

Next, we will show the paging query, sub-query (still using the data in the table test2 above). The sql means to query 2 pieces of data starting from the first row: