Two, MySql data manipulation (ii)

Data Management:
    

  First, the query data: select * from table name;
    add data: insert into table;
    change where condition data update table set field name = field value;
    empty table: delete from table where conditions; delete table data, without deleting the table data structure, can be rolled back
    truncate table show; delete table data, delete data structure of a table, not rollback

  Second, the query:
    query all columns: select * from table name
    query specifies column: select set out in 1, 2 column names from the table name
    from the alias: select 1 as set out in the custom column names, column names, column names from 2 Customize table were
    merged column query: SELECT (column name + - * / column names) from table
  III deduplication data query:
    SELECT DISTINCT (column names) from table;
    SELECT DISTINCT column names from table name;
  IV paging query: limit start line, a few lines of the query
    SELECT * FROM employee where conditions lIMIT 0,2;
    Home = (this page -1) * number of lines per page
    Note: in the query using the rearmost limit
  V. query packet: column group by having the conditions to be grouped in
  six sorting query: order by columns to be sorted

Guess you like

Origin www.cnblogs.com/yanghaoyu0624/p/11444777.html