[MySql learning experience], mysql learning experience

Source: Internet
Author: User

[MySql learning experience], mysql learning experience

5. Common clauses in MySql

1. where clause

We all know that when querying data, we may not be able to query the data in the entire table. When conditional queries are available, we will use the where clause. Its structure:

Select * from [Table name] where [condition].

2. like clause

The like clause is a fuzzy query with the following wildcards:

(1). % replace one or more characters

(2).-replace only one character

(3). [...] match any character in the middle

(4). [^ |!...] Any character that is not in the middle of square brackets (where "|" means "or)

Generally, the like clause and the where clause are used together.

Select * from [Table name] where field like 'condition ';

3. in, between,

(1). "in" SELECT [field name] FROM [Table name] Where [field name] in (value 1, value 2 ,....);

(2). "between" SELECT [field name] FROM [Table name] Where [field name] between [value 1] AND [value 2];

(3). "as" alias select name as for the field,... from [Table name]

Vi. MySql Import and Export

1. Export table:

(1) SELECT * FROM [Table name]-> into outfile 'path \ The name of the exported .txt ';

(2) mysqldump-u root-p TUTORIALS [Table name]> dump.txt under the Doc command

Password *****
2. Import table:
Load data local infile 'dump.txt 'into table [name of the TABLE to which DATA is inserted];

    

3. Export the database:

Mysqldump-u root-p [database name]> export file name

4. Import the database:

Mysql-u root-p [database name] <location of the backup file

  

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.