2018-07-09MySQL 中TEXT的使用TINYTEXT 256 bytes TEXT 65,535 bytes ~64kb MEDIUMTEXT 16,777,215 bytes ~16MB LONGTEXT 4,294,967,295 bytes ~4GB 尽管text大约可以是64kb 可字段值大于65,535 bytes 远远的小于64kb,也是不可以的
2018-06-26查询一个表的id 并统计在另一个表出现的次数select p.title,p.pic,p.id,p.author, p.time,p.is_ok,count(pz.post_id) c FROM pre_post p,pre_post_zan pz WHERE pz.post_id = p.id and pz.zan=1 group by(pz.post_id) ORDER BY c desc 注:
2018-06-26数据库查询中的between用法$list = $this->model->table('post')->field('title,pic,id,author, time,is_ok')->where($condition) ->where('author="'.$uname.'"'.' and time between '.$time_l .' and '.$time_r )->limi
2018-06-26mysql 多关键词搜索concat$condition .= empty($keywords) ? '' : " and concat(title,keywords) like '%{$keywords}%'"; //search CONCAT(`title`,`tag`,`description`) concat(title,keywords) like '%{$keywords}%'"
2018-02-26转载 | ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)Linux环境解决Mysql权限不足 以下方法亲测好使,鉴于版本的多样性,如果解决不了,请百度, Linux 环境相关的解决 Mysql 权限不足还是很多文章的。 方法操作很简单,如下: # /etc/init.d/MySQL stop # mysqld_safe --user=mysql --skip-grant-tables --skip-network#file#配置文件
2018-01-18mysql练习题(一)--建表 --学生表 CREATE TABLE `Student`( `s_id` VARCHAR(20), `s_name` VARCHAR(20) NOT NULL DEFAULT '', `s_birth` VARCHAR(20) NOT NULL DEFAULT '', `s_sex` VARCHAR(10) NOT NULL DEFAULT '',
2018-01-18mysql数据表同时使用创建时间/更新时间字段原因:一张表同时只能使用一个current_timestamp 创表 1. 用createtime记录创建时间 2. 用updatetime记录更新时间 create table test1(a varchar(3), createtime timestamp,//创建时间 updatetime timestamp);//更新时间 插入 insert int
2017-12-10数据库优化explain 用于事件前 explain各列意义 table type(最好到最差const / eq_reg / ref / range / index / all) possible_keys key key_len ref rows sql语句优化 1. 避免在where子句中进行null值判断,否则将导致引擎放弃使用索引而进行全表扫描 如: sel
2017-12-10数据库多表查询+事务+数据引擎+字符集多表关系 1对多,多对1 在多的一方加入另一方的外键 多对多 使用中间表,分别引用两方的ID 1对1 主键同步 两个表中有关系的记录id一致 在一方加入 另一方的外键 在另一方加入外键 左连接 left join select *from user left join article on user.id = article.userid; 右连接 righ
2017-12-10案例-多表查询、子查询实例03(有答案)一、设有一数据库,包括四个表:学生表(Student)、课程表(Course)、成绩表(Score)以及教师信息表(Teacher)。四个表的结构分别如表1-1的表(一)~表(四)所示,数据如表1-2的表(一)~表(四)所示。用SQL语句创建四个表并完成相关题目。 #建学生信息表student create table student ( sno varch#varchar#student#null
2017-12-06案例-多表查询、子查询实例02(有答案)以下所有操作在查询管理器中手工书写sql语句完成 1、按下列步骤创建数据库和表 1.2、在这个数据库中创建一个名为[学生表]的表,由[学号]、[姓名]、[专业]、[班级] 字段组成。[学号] 字段为主键,类型为int;[姓名] 和 [专业] 字段类型为varchar, 长度为6和20;[班级] 字段类型为char,长度为4。这些字段均不允许NULL值。 us