Basic database statement(3)

1. Query (select * from table name)
select
field list
from
table name list
where
condition list
group by
grouping field
having
grouping conditions after grouping
order by
sorting
limit
paging limit
Second, basic query

  • Multi-field query (such as query only name and age select name, age from student) query all (select * from student)
    Note: This table is student.
  • Remove duplicate results (select distinct column name from table name)
  • Calculate the value of certain two columns (select column name 1, column name 2, column name 1 + column name 2 from student)
    Note: If the results of the two columns are null, the result will be null.
    Here, if column name 2 is null, Then the above statement can be written as
    "select column name 1, column name 2, column name 1+ifnull (column name 2, 0) from student"
  • From the alias (select column name 1, column name 2, column name 1 + column name 2 as alias from student) can make the two column names added to have other names

Guess you like

Origin blog.csdn.net/m0_46217913/article/details/104063519