[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