MySQL Common syntax

Source: Internet
Author: User

Updating data: Update table name set health name = "changed value" where built = ...

Delete data: Delete from table name where ...

Index: CREATE index name on table name (key name);

Create the attempt: the Create View name (key, key) as SELECT Matchno,abs (won-lost) from table name;


Authorization: For example, Grant Select on PLAYERS to ZCL; Grant user the right to have select in PLAYERS table

Delete database, table, view, index, DROP, syntax format: drop+ object + name;

View the version of the database: SELECT @ @version;

Generate current Timestamp: SELECT Unix_timestamp (now ())

Convert timestamp to time: SELECT from_unixtime (1431964800, '%y year%m month%d%h time%m minute%s seconds ')

Subtract one day of data from a Time field: UPDATE auth_user set Checktime=date_sub (Checktime,interval 1 days)

Attribute values are summed: SELECT DISTINCT (gd_project) from gd_video_location


This article is from the "read" blog, please be sure to keep this source http://zcl1101017794.blog.51cto.com/7962179/1603591

MySQL Common syntax

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.