"Zero-Distance Access to mysql" study notes, zero-Distance Access to mysql

Source: Internet
Author: User
Tags integer division rtrim

"Zero-Distance Access to mysql" study notes, zero-Distance Access to mysql

1. add, delete, modify, and query data tables (crud ):

For tables:

Add: create table XXXX

Delete: drop table XXXX

Change: alter table XXXX rename to XXXX

Query: select * from XXXX

For rows:

Add: insert into XXXX (xxxx) values (xxxx)

Insert into XXXX set xxxx = xx, xxxx = xx

Delete: delete from XXXX where xxxx

Change: update table set xxxx = xxxx where xxxx = xxxx

Query: select xxxx from XXXX

For columns:

Add: alter table XXXX add xxxx ()

Delete: alter table XXXX drop xxxx

Change: alter table XXXX change xxxx

Alter table XXXX modify xxxx

Check: show columns from XXXX

 

2. Operators and functions

Character Functions

Concat () select concat ('hha ','-', 'hdf ')

Concat_ws () select concat_ws ('=', 'A', 'B', 'C ')

Format () select format (125060.752, 2)

Lower () select lower ('hiiho ')

Upper () select upper ('fsfds ')

Left () select left ('fsfds ', 2)

Right () select right ('fsfds ', 2)

Length () select length ('fsfds ')

Ltrim () select ltrim ('fsfds ')

Rtrim () select rtrim ('fsfds ')

Trim () select trim ('fsfds ')

Select trim (leading '? 'From' fs? Fds ')

Select trim (trailing '? 'From' fs? Fds ')

Select trim (both '? 'From' fs? Fds ')

Substring () select substring ('fsfds ', 2, 3)

Select substring ('fsfds ', 2)

Like select 'myufsd' like'm %'

Select * from test where first_name like '% 1% %' escape '1'

% Represents any character

_ Represents any character

Replace () select replace ('fsgasgsfa', 's', 'T ')

 

3. Numeric Operators

Div Integer Division

 

4. Comparison operations comply with functions

Not between and

Not in

 

5. time and date functions

Now ()

Curdate ()

Curtime ()

Date_add ()

Datediff ()

Date_format ()

 

6. Information Functions

Connection_id ()

Datebase ()

Last_insert_id ()

User ()

Version ()

 

7. Aggregate functions

...

 

8. encryption functions

Md5 ()

Password ()

 

Related Article

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.