MySQL operation
2016-04-13 20:18
746 查看
Loading Data into a Table
(1)Loading data from a file like this:mysql> LOAD DATA LOCAL INFILES '/path/pet.txt' INTO TABLE pet
->LINES TERMINATED BY '\r\n';
**if generate a load error,like the command is not useful,
when entry mysql,add this “local_infile=1”
for instance:
mysql -u root - p –local-infile=1 -e “LOAD DATA LOCAL INFILE “/path/text” INTO TABLE XXX FILEDS TERMINATED BY ‘,’**
(2)directly insert:
mysql> INSERT INTO pet
-> VALUES('paffbal','diane','1990-03-30',NULL);
Retrieving information from a table
The general form of the statement is:SELECT what_to_select
FROM which_table
WHERE conditions_to_satisfy
ORDER BY which_column;
the default sort order is ascending,if what to in reverse order add DESC keyword to the name of the column you sorting by.
you can sort on multiple columns,and you can sort different columns in different directions.
When you do an ORDER BY ,NULL values are presented first.
Pattern matching
SQL pattern matching enables you to use “_” to match any single character and “%” to match an arbitrary number of characters.In MySQL, SQL patterns are case-insensitive by default.You do not use = or <> when you use SQL patterns, use the LIKE or NOT LIKE comparison operation instead.to find names beginning with “b”:
mysql> SELECT * FROM pet WHERE name LIKE 'b%';
to find names ending with “fy”:
mysql> SELECT *FROM pet WHERE name LIKE '%fy';
相关文章推荐
- SQLSERVER--定期清理维护作业的历史记录
- JDBC写数据到文件中再Copy到postgresql中
- 监控SQL
- invalid floating point operation occurred(SQL Server发生无效浮点数操作)
- Hadoop监控页面查看Hive的完整SQL
- mysql运维-二进制日志BINARY LOG清理
- Oracle:PL/SQL Developer 创建一个新用户
- 监控mysql主从一致性shell脚本
- hadoop集群配置之hive1.2.0安装部署(远程mysql)
- 8个值得关注的SQL-on-Hadoop框架
- MySQL复制中slave延迟监控
- SQLiteOpenHelper
- 监控Mysql主从同步
- 数据切分——Mysql分区表的管理与维护
- 数据切分——Mysql分区表的管理与维护
- 数据切分——Mysql分区表的管理与维护
- Nova报错:OperationalError: (_mysql_exceptions.OperationalError) (1040, 'Too many connections')
- 160411、实时监控mysql数据库变化
- MYSQL企业常用架构与调优经验分享
- 深入浅出Hive企业级架构优化、Hive Sql优化、压缩和分布式缓存(企业Hadoop应用核心产品)