Mysql 留言表 实例
来源:互联网 发布:预防电信网络诈骗 编辑:程序博客网 时间:2024/04/29 06:37
############################################################
# #
# 数据库表 #
# #
############################################################
# 删除数据库
DROP database IF EXISTS sweet;
# 创建数据库
create database sweet;
# 使用数据库
use sweet;
#
# 留言表
#
DROP TABLE IF EXISTS message;
CREATE TABLE message (
mid int unsigned not null auto_increment COMMENT '留言的id',
name varchar(128) not null COMMENT '昵称',
content varchar(6666) not null COMMENT '消息内容',
pubtime timestamp default current_timestamp COMMENT '发送时间,默认值',
examine tinyint NOT NULL DEFAULT 0 COMMENT '审核程度,0未审,1已审,2屏蔽',
PRIMARY KEY (mid)
);
############################################################
# #
# 插入数据 #
# #
############################################################
insert into message(name, content) values('admin', 'one');
insert into message(name, content) values('admin', 'two');
insert into message(name, content) values('admin', 'three');
insert into message(name, content) values('admin', 'four');
insert into message(name, content) values('admin', 'five');
insert into message(name, content) values('admin', 'six');
############################################################
# #
# 查询语句 #
# #
############################################################
select * from message;
# 查询所有未被屏蔽的博客数量
select count(*) as total from message where examine<>2;
# 分页查询所有未被屏蔽的博客,1:0-3, 2:3-3 3:6-3
select * from message where examine<>2 order by mid desc limit 0,3;
select * from message where examine<>2 order by mid desc limit 3,6;
# 查询所有未审核的博客
select * from message where examine=0 order by mid asc;
# 查询所有审核通过的博客
select * from message where examine=1 order by mid asc;
# 查询所有审核屏蔽的博客
select * from message where examine=2 order by mid asc;
# 设置某个留言审核通过
update message set examine=1 where mid=1;
# 设置某个留言审核屏蔽
update message set examine=2 where mid=2;
# #
# 数据库表 #
# #
############################################################
# 删除数据库
DROP database IF EXISTS sweet;
# 创建数据库
create database sweet;
# 使用数据库
use sweet;
#
# 留言表
#
DROP TABLE IF EXISTS message;
CREATE TABLE message (
mid int unsigned not null auto_increment COMMENT '留言的id',
name varchar(128) not null COMMENT '昵称',
content varchar(6666) not null COMMENT '消息内容',
pubtime timestamp default current_timestamp COMMENT '发送时间,默认值',
examine tinyint NOT NULL DEFAULT 0 COMMENT '审核程度,0未审,1已审,2屏蔽',
PRIMARY KEY (mid)
);
############################################################
# #
# 插入数据 #
# #
############################################################
insert into message(name, content) values('admin', 'one');
insert into message(name, content) values('admin', 'two');
insert into message(name, content) values('admin', 'three');
insert into message(name, content) values('admin', 'four');
insert into message(name, content) values('admin', 'five');
insert into message(name, content) values('admin', 'six');
############################################################
# #
# 查询语句 #
# #
############################################################
select * from message;
# 查询所有未被屏蔽的博客数量
select count(*) as total from message where examine<>2;
# 分页查询所有未被屏蔽的博客,1:0-3, 2:3-3 3:6-3
select * from message where examine<>2 order by mid desc limit 0,3;
select * from message where examine<>2 order by mid desc limit 3,6;
# 查询所有未审核的博客
select * from message where examine=0 order by mid asc;
# 查询所有审核通过的博客
select * from message where examine=1 order by mid asc;
# 查询所有审核屏蔽的博客
select * from message where examine=2 order by mid asc;
# 设置某个留言审核通过
update message set examine=1 where mid=1;
# 设置某个留言审核屏蔽
update message set examine=2 where mid=2;
update message set examine=2 where mid<7;
用该实例做的网站
http://www.fengyunxiao.cn
0 0
- Mysql 留言表 实例
- php与mysql应用实例:留言本
- PHP+MYSQL留言本
- PHP MYSQL留言本
- smarty学习-留言本实例
- 超级留言本制作实例
- PHP MVC留言本实例
- PHP MVC留言本实例
- PHP+MYSQL留言本(二)
- php & mysql 留言版2
- PHP+Mysql制作留言发布
- 如何解决 JMeter 通过 JDBC 访问 Oracle 和 MySQL 的问题 (留言中有 Test Plan 实例下载)
- 如何解决 JMeter 通过 JDBC 访问 Oracle 和 MySQL 的问题 (留言中有 Test Plan 实例下载)
- JSP+Hibernate入门级实例--留言系统
- JSP+Hibernate入门级实例--留言系统
- 实例学习PHP之留言程序
- php运用xml实例--留言本
- 超级留言本制作实例 阿余
- 完美运动框架(源代码)move+1.js
- Spring框架下PropertyPlaceholderConfigurer类
- jquery.form.js beforeSubmit失效问题。
- axis1-myeclipse/eclipse-入门级别-资源、流程、常见问题
- 夜间模式
- Mysql 留言表 实例
- IntelliJ Idea 常用快捷键列表
- migration使用无效
- javaScript对象与函数
- c# 发送邮箱时 System.Net.Mail.SmtpException: 事务失败
- js获取select标签选中的值
- What is CRA?
- Python日期时间函数
- Interleaving String leetcode