python PyMySQL 数据库操作

时间:2022-05-22 00:12:29
【文件属性】:
文件名称:python PyMySQL 数据库操作
文件大小:3KB
文件格式:PY
更新时间:2022-05-22 00:12:29
python 数据库 database """ 新建一个公司新闻表数据表。 使用python完成: 公司新闻表(ID,新闻标题,发布时间,点击次数) a.一次性添加2条记录(文件一) b.根据用户输入的标题删除记录(文件二) """ # 引入模块 from Ab import Ab_MySQL # 实例化对象 A1 = Ab_MySQL() # 创建表 create_str = """ create table news( new_id int unsigned not null primary key auto_increment comment '新闻id', new_title varchar(50) not null comment '新闻标题', new_date date comment '发布时间', new_click int(10) comment '点击次数' )engine=innodb default charset=utf8 comment='新闻表'; """ # 插入5条数据 five_data = """ insert into news values (1, '明天表白', '匿名', '

网友评论