当前位置: 首页 > wzjs >正文

南宁新技术产业建设开发总公司网站推广策划方案怎么写

南宁新技术产业建设开发总公司网站,推广策划方案怎么写,网络推广计划书目录,广州哪里有网站开发目录 1.日期函数 1.1获得年月日 1.2获得时分秒 1.3获得年月日时分秒 1.4获得时间戳 1.5日期加天数 1.6日期减天数 1.7计算两个日期相隔多少天 1.8案例 2.字符串函数 2.1获取字符集 2.2字符串拼接 2.3字符串查询 2.4大小写转换 2.5字符串提取 2.6字符串长度 2.7…

目录

1.日期函数

1.1获得年月日

1.2获得时分秒

1.3获得年月日时分秒

1.4获得时间戳

1.5日期加天数

1.6日期减天数

1.7计算两个日期相隔多少天

1.8案例

2.字符串函数

2.1获取字符集

2.2字符串拼接

2.3字符串查询

2.4大小写转换

2.5字符串提取

2.6字符串长度

2.7字符串替换

2.8字符串截取

2.9去除空格

3.数学函数

3.1绝对值

3.2转二进制

3.3转十六进制

3.4进制转换

3.5向上向下取整

3.6保留n位小数

3.7随机数

3.8取模

4.其他函数

4.1查询当前用户

4.2显示当前数据库

4.3md5摘要

4.4passwor加密

4.5ifnull


1.日期函数

1.1获得年月日

mysql> select current_date();
+----------------+
| current_date() |
+----------------+
| 2024-03-24     |
+----------------+
1 row in set (0.00 sec)

1.2获得时分秒

mysql> select current_time();
+----------------+
| current_time() |
+----------------+
| 22:10:04       |
+----------------+
1 row in set (0.00 sec)

1.3获得年月日时分秒

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2024-03-24 22:30:14 |
+---------------------+
1 row in set (0.00 sec)

1.4获得时间戳

会以日期的方式显示。

mysql> select current_timestamp();
+---------------------+
| current_timestamp() |
+---------------------+
| 2024-03-24 22:10:55 |
+---------------------+
1 row in set (0.00 sec)

1.5日期加天数

mysql> select date_add('2022-01-01', interval 12 day) as res;
+------------+
| res        |
+------------+
| 2022-01-13 |
+------------+
1 row in set (0.00 sec)mysql> select date_add('2022-01-01', interval 3 month) as res;
+------------+
| res        |
+------------+
| 2022-04-01 |
+------------+
1 row in set (0.00 sec)

1.6日期减天数

mysql> select date_sub('2022-01-01', interval 12 day) as res;
+------------+
| res        |
+------------+
| 2021-12-20 |
+------------+
1 row in set (0.00 sec)mysql> select date_sub('2022-01-01', interval 3 month) as res;
+------------+
| res        |
+------------+
| 2021-10-01 |
+------------+
1 row in set (0.00 sec)

1.7计算两个日期相隔多少天

mysql> select datediff('2024-03-24', '2022-01-01') as res;
+------+
| res  |
+------+
|  813 |
+------+
1 row in set (0.00 sec)


1.8案例

  • 创建一张生日表
mysql> create table bir(-> id int primary key auto_increment,-> birthday date-> );
Query OK, 0 rows affected (0.02 sec)mysql> insert into bir(birthday) values('1998-05-28');
Query OK, 1 row affected (0.00 sec)mysql> insert into bir(birthday) values(current_date);
Query OK, 1 row affected (0.00 sec)mysql> insert into bir(birthday) values(current_timestamp());
Query OK, 1 row affected, 1 warning (0.00 sec)mysql> insert into bir(birthday) values(date(current_timestamp()));
Query OK, 1 row affected (0.00 sec)mysql> select * from bir;
+----+------------+
| id | birthday   |
+----+------------+
|  1 | 2024-03-24 |
|  2 | 1998-05-28 |
|  3 | 2024-03-24 |
|  4 | 2024-03-24 |
+----+------------+
4 rows in set (0.00 sec)

第三次插入的为时间戳,mysql会自动转化为日期。

  • 创建一个留言表
mysql> create table mes(-> id int primary key auto_increment,-> message varchar(100) not null,-> sendtime datetime-> );
Query OK, 0 rows affected (0.02 sec)mysql> insert into mes (message, sendtime) values ('窗前明月光', now());
Query OK, 1 row affected (0.00 sec)mysql> insert into mes (message, sendtime) values ('疑是地上霜', now());
Query OK, 1 row affected (0.00 sec)mysql> select * from mes;
+----+-----------------+---------------------+
| id | message         | sendtime            |
+----+-----------------+---------------------+
|  1 | 窗前明月光      | 2024-03-24 22:29:33 |
|  2 | 疑是地上霜      | 2024-03-24 22:29:43 |
+----+-----------------+---------------------+
2 rows in set (0.00 sec)
  • 查询3分钟之内发的评论
mysql> select * from mes
+----+-----------------+---------------------+
| id | message         | sendtime            |
+----+-----------------+---------------------+
|  1 | 窗前明月光      | 2024-03-24 22:29:33 |
|  2 | 疑是地上霜      | 2024-03-24 22:29:43 |
|  3 | 举头望明月      | 2024-03-24 22:31:42 |
|  4 | 低头思故乡      | 2024-03-24 22:31:49 |
+----+-----------------+---------------------+
4 rows in set (0.00 sec)mysql> select * from mes where sendtime > date_sub(now(), interval 3 minute);
+----+-----------------+---------------------+
| id | message         | sendtime            |
+----+-----------------+---------------------+
|  3 | 举头望明月      | 2024-03-24 22:31:42 |
|  4 | 低头思故乡      | 2024-03-24 22:31:49 |
+----+-----------------+---------------------+
2 rows in set (0.00 sec)

2.字符串函数

2.1获取字符集

mysql> select charset('123');
+----------------+
| charset('123') |
+----------------+
| utf8           |
+----------------+
1 row in set (0.00 sec)mysql> select charset(123);
+--------------+
| charset(123) |
+--------------+
| binary       |
+--------------+
1 row in set (0.00 sec)mysql> select charset(sendtime) from mes;
+-------------------+
| charset(sendtime) |
+-------------------+
| binary            |
| binary            |
| binary            |
| binary            |
+-------------------+
4 rows in set (0.00 sec)

2.2字符串拼接

类似于c语言中的strcat

mysql> select concat('123', 'hello', 'world') as res;
+---------------+
| res           |
+---------------+
| 123helloworld |
+---------------+
1 row in set (0.00 sec)
mysql> select concat('id: ', id, ' 发送了一条消息: ', message, ' 时间:', sendtime) as res from mes;
+-------------------------------------------------------------------------+
| res                                                                     |
+-------------------------------------------------------------------------+
| id: 1 发送了一条消息: 窗前明月光 时间:2024-03-24 22:29:33               |
| id: 2 发送了一条消息: 疑是地上霜 时间:2024-03-24 22:29:43               |
| id: 3 发送了一条消息: 举头望明月 时间:2024-03-24 22:31:42               |
| id: 4 发送了一条消息: 低头思故乡 时间:2024-03-24 22:31:49               |
+-------------------------------------------------------------------------+
4 rows in set (0.00 sec)

2.3字符串查询

instr(string, substring) 返回substring在string中的下标(从1开始),不存在返回0。

mysql> select instr('helfjsadio123fjkdsfa', '123');
+--------------------------------------+
| instr('helfjsadio123fjkdsfa', '123') |
+--------------------------------------+
|                                   11 |
+--------------------------------------+
1 row in set (0.00 sec)

2.4大小写转换

ucase转大写,lcase转小写。

mysql> select ucase('fAjfkjBSD213jD1s');
+---------------------------+
| ucase('fAjfkjBSD213jD1s') |
+---------------------------+
| FAJFKJBSD213JD1S          |
+---------------------------+
1 row in set (0.00 sec)
mysql> select lcase('fAjfkjBSD213jD1s');
+---------------------------+
| lcase('fAjfkjBSD213jD1s') |
+---------------------------+
| fajfkjbsd213jd1s          |
+---------------------------+
1 row in set (0.00 sec)

2.5字符串提取

left(string, length),string中从左往右提取length个字符。

mysql> select left('hello world', 8);
+------------------------+
| left('hello world', 8) |
+------------------------+
| hello wo               |
+------------------------+
1 row in set (0.00 sec)

right(string, length)),stringg中从右向左提取length个字符。

mysql> select right('hello world', 7);
+-------------------------+
| right('hello world', 7) |
+-------------------------+
| o world                 |
+-------------------------+
1 row in set (0.00 sec)

2.6字符串长度

mysql> select length('fds28f3j28x');
+-----------------------+
| length('fds28f3j28x') |
+-----------------------+
|                    11 |
+-----------------------+
1 row in set (0.00 sec)

案例:求学生表中学生姓名占用的字节数

mysql> select name, length(name) 长度 from exam_result;
+-----------+--------+
| name      | 长度   |
+-----------+--------+
| 唐三藏    |      9 |
| 猪悟能    |      9 |
| 曹孟德    |      9 |
| 刘玄德    |      9 |
| 孙权      |      6 |
| 宋公明    |      9 |
| 张翼德    |      9 |
| 关云长    |      9 |
+-----------+--------+
8 rows in set (0.00 sec)

length函数返回字符串长度,以字节为单位。如果是多字节字符则计算多个字节数;如果是单字节字符则算作一个字节。比如:字母,数字算作一个字节,中文表示多个字节数(与字符集编码有关),这里是3个字节。

2.7字符串替换

replace(str, s1, s2),在str中,用s2替换s1。

mysql> select replace('hello world', 'world', 'mysql');
+------------------------------------------+
| replace('hello world', 'world', 'mysql') |
+------------------------------------------+
| hello mysql                              |
+------------------------------------------+
1 row in set (0.00 sec)

案例:将表中所有姓孙的同学改成姓周。

mysql> select name from exam_result;
+-----------+
| name      |
+-----------+
| 唐三藏    |
| 猪悟能    |
| 曹孟德    |
| 刘玄德    |
| 孙权      |
| 宋公明    |
| 张翼德    |
| 关云长    |
+-----------+
8 rows in set (0.00 sec)mysql> select replace(name, '孙', '周') from exam_result;
+-----------------------------+
| replace(name, '孙', '周')   |
+-----------------------------+
| 唐三藏                      |
| 猪悟能                      |
| 曹孟德                      |
| 刘玄德                      |
| 周权                        |
| 宋公明                      |
| 张翼德                      |
| 关云长                      |
+-----------------------------+
8 rows in set (0.00 sec)

注意:select和replace配合使用并不会修改数据库中的数据。

2.8字符串截取

substring(str, pos, length),str中的pos位置开始截取length个字符。length不写表示截取完。

mysql> select substring('fja382nqf8q8n2nc', 4);
+----------------------------------+
| substring('fja382nqf8q8n2nc', 4) |
+----------------------------------+
| 382nqf8q8n2nc                    |
+----------------------------------+
1 row in set (0.00 sec)mysql> select substring('fja382nqf8q8n2nc', 4, 5);
+-------------------------------------+
| substring('fja382nqf8q8n2nc', 4, 5) |
+-------------------------------------+
| 382nq                               |
+-------------------------------------+
1 row in set (0.00 sec)

案例:截取name中第二个到第三个字段。

mysql> select name, substring(name, 2, 2) from exam_result;
+-----------+-----------------------+
| name      | substring(name, 2, 2) |
+-----------+-----------------------+
| 唐三藏    | 三藏                  |
| 猪悟能    | 悟能                  |
| 曹孟德    | 孟德                  |
| 刘玄德    | 玄德                  |
| 孙权      | 权                    |
| 宋公明    | 公明                  |
| 张翼德    | 翼德                  |
| 关云长    | 云长                  |
+-----------+-----------------------+
8 rows in set (0.00 sec)

2.9去除空格

ltrim去除左边空格,rtrim去除右边的空格。

mysql> select ltrim('  nihao  ') as res;
+---------+
| res     |
+---------+
| nihao   |
+---------+
1 row in set (0.00 sec)mysql> select rtrim('  nihao  ') as res;
+---------+
| res     |
+---------+
|   nihao |
+---------+
1 row in set (0.00 sec)

3.数学函数

3.1绝对值

mysql> select abs(-21);
+----------+
| abs(-21) |
+----------+
|       21 |
+----------+
1 row in set (0.00 sec)

3.2转二进制

mysql> select bin(7);
+--------+
| bin(7) |
+--------+
| 111    |
+--------+
1 row in set (0.00 sec)

3.3转十六进制

mysql> select hex(41);
+---------+
| hex(41) |
+---------+
| 29      |
+---------+
1 row in set (0.00 sec)

3.4进制转换

任意两种进制之间的转换

mysql> select conv(21, 10, 4);
+-----------------+
| conv(21, 10, 4) |
+-----------------+
| 111             |
+-----------------+
1 row in set (0.00 sec)

十进制转四进制

3.5向上向下取整

ceiling向上取整,floor向下取整

mysql> select ceiling(2.11);
+---------------+
| ceiling(2.11) |
+---------------+
|             3 |
+---------------+
1 row in set (0.00 sec)mysql> select floor(2.11);
+-------------+
| floor(2.11) |
+-------------+
|           2 |
+-------------+
1 row in set (0.00 sec)

3.6保留n位小数

mysql> select format(1.234578, 5);
+---------------------+
| format(1.234578, 5) |
+---------------------+
| 1.23458             |
+---------------------+
1 row in set (0.00 sec)

3.7随机数

mysql> select rand();
+---------------------+
| rand()              |
+---------------------+
| 0.21503182520627215 |
+---------------------+
1 row in set (0.00 sec)mysql> select rand();
+--------------------+
| rand()             |
+--------------------+
| 0.8824897100054563 |
+--------------------+
1 row in set (0.00 sec)

3.8取模

mysql> select mod(10, 3);
+------------+
| mod(10, 3) |
+------------+
|          1 |
+------------+
1 row in set (0.00 sec)

4.其他函数

4.1查询当前用户

mysql> select user();
+--------+
| user() |
+--------+
| root@  |
+--------+
1 row in set (0.00 sec)

4.2显示当前数据库

mysql> select database();
+------------+
| database() |
+------------+
| user5      |
+------------+
1 row in set (0.00 sec)

4.3md5摘要

如果当前数据库存储的是密码,并且是以明文的形式保存的,如果被黑客攻击了,拿到了数据库中所有人的密码,那就麻烦了,针对这种情况,保存密码可以使用md5形成一个32位的数据摘要。

mysql> create table user(-> id int primary key auto_increment,-> name varchar(20) not null,-> password char(32) not null-> );
Query OK, 0 rows affected (0.02 sec)mysql> insert into user(name, password) values('张三', 1234);
Query OK, 1 row affected (0.00 sec)mysql> insert into user(name, password) values('李四', md5('1234'));
Query OK, 1 row affected (0.00 sec)mysql> select * from user;
+----+--------+----------------------------------+
| id | name   | password                         |
+----+--------+----------------------------------+
|  1 | 张三   | 1234                             |
|  2 | 李四   | 81dc9bdb52d04dc20036dbd8313ed055 |
+----+--------+----------------------------------+
2 rows in set (0.00 sec)

当用户登录的时候,只需要使用用户名和md5后的摘要在表中查找,如果找到了说明密码正确

mysql> select * from user where name='李四' and password=md5('1234');
+----+--------+----------------------------------+
| id | name   | password                         |
+----+--------+----------------------------------+
|  2 | 李四   | 81dc9bdb52d04dc20036dbd8313ed055 |
+----+--------+----------------------------------+
1 row in set (0.00 sec)

4.4passwor加密

在上述例子当中,我们也可以使用passw进行加密

mysql> select password('1234');
+-------------------------------------------+
| password('1234')                          |
+-------------------------------------------+
| *A4B6157319038724E3560894F7F932C8886EBFCF |
+-------------------------------------------+
1 row in set, 1 warning (0.00 sec)mysql> select md5('1234');
+----------------------------------+
| md5('1234')                      |
+----------------------------------+
| 81dc9bdb52d04dc20036dbd8313ed055 |
+----------------------------------+
1 row in set (0.00 sec)

可以看到两种方式得到的摘要是不同的。

4.5ifnull

ifnull(val1, val2) 如果val1为null,返回val2,否则返回val1的值

mysql> select ifnull(123, 456);
+------------------+
| ifnull(123, 456) |
+------------------+
|              123 |
+------------------+
1 row in set (0.00 sec)mysql> select ifnull(null, 456);
+-------------------+
| ifnull(null, 456) |
+-------------------+
|               456 |
+-------------------+
1 row in set (0.00 sec)

http://www.dtcms.com/wzjs/341058.html

相关文章:

  • 长春网站建设开发西安百度seo排名
  • 一个网站如何做推广方案青岛网络优化厂家
  • 分销网站有哪些seo优化网页
  • mac服务器 做网站手游cpa推广平台
  • 网站怎么做长尾关键词网站制作公司高端
  • 网站维护是谁做的百度一下官方网
  • 武汉地区网站建设可以直接打开网站的网页
  • 微商可以做网站推广吗阿里云域名
  • 开发app代驾软件多少钱网站seo整站优化
  • 东莞中堂网站建设seo课程哪个好
  • 我请网络公司做的网站上的图片被当广告拦截了_怎么回事百度搜不干净的东西
  • 中国建设人才服务信息网是正规网站百度企业推广怎么收费
  • 仙桃做网站域名被墙查询检测
  • 网站开发工资有多少seo的中文含义是
  • 做动态网站的app全国最新疫情实时状况地图
  • 嘉兴建企业网站西安seo
  • 网站建设求职具备什么谷歌关键词排名查询
  • 山东省建设协会网站产品网络推广怎样做
  • 做seo时网站更新的目的东莞网络推广平台
  • 社区做图网站有哪些内容网站搜索引擎优化的基本内容
  • 如何创建网站的过程搜索关键词怎么让排名靠前
  • 经典网站模板下载南京百度seo代理
  • 网站做的好不好十大小说网站排名
  • 做网站应该用多少分辨率如何做网站seo
  • 中国开头的网站怎么做谷歌搜索官网
  • 淘客网站开发公司百度推广助手怎么用
  • 高新网站设计找哪家百度seo关键词优化市场
  • 注册网站地址第1行第二行怎么填seo需要掌握什么技能
  • 网站通栏设计素材seo优化上首页
  • 郑州专业网站制作的公司哪家好搜图片找原图