上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 18 下一页
摘要: 1、修改表名 alter table student rename student_new; 2、修改字段名字 alter table student change sname new_name char(8); 3、修改字段的数据类型 alter table student modify snam 阅读全文
posted @ 2022-12-31 15:11 小粉优化大师 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 1、查看表 show tables; 2、看表结构 DESC 表名; DESCRIBE 表名; 3、以创建学生表为例 create table student( sno char(5) primary key not null, sname char(8) not null, ssex enum(' 阅读全文
posted @ 2022-12-31 15:08 小粉优化大师 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 1、约束关键字介绍 约束条件 说明 PRIMARY KEY 主键约束,用于唯一标识对应的记录 FOREIGN KEY 外键约束 NOT NULL 非空约束 UNIQUE 唯一性约束 DEFAULT 默认值约束,用于设置字段的默认值 AUTO_INCREMENT 自增约束,用于设置表的字段值自动增加 阅读全文
posted @ 2022-12-31 15:03 小粉优化大师 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 1、测试表结果 create table student( sno varchar(20) primary key, sname varchar(20), sex enum('男','女'), age int, sdept varchar(20) ); 2、增 2.1、单条插入 insert int 阅读全文
posted @ 2022-12-31 14:50 小粉优化大师 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 1、安装模板 pip install aiomysql pip install sqlalchemy 2、engine核心 2.1、初始化数据库 # -*- coding: utf-8 -*- import asyncio from sqlalchemy.ext.asyncio import cre 阅读全文
posted @ 2022-12-13 14:29 小粉优化大师 阅读(730) 评论(0) 推荐(0) 编辑
摘要: 1、指定列查询 1.1、查询所有记录 select * from student; 1.2、查询学号、学生名字 select sno,sname from student; 1.3、定义列的别名 select sno as 学号,sname as 学生名字 from student; + + + | 阅读全文
posted @ 2022-12-04 15:41 小粉优化大师 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 1、备份 1.1、备份多张表 mysqldump -uroot -proot cjgl score course > score_course.sql 1.2、备份多个数据库 mysqldump -uroot -proot --databases cjgl school > cjgl_school. 阅读全文
posted @ 2022-12-04 15:07 小粉优化大师 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 1、事务的介绍 1、事务是一组有着内在逻辑联系的SQL命令。 2、支持事务的数据库系统要么执行一个事务里的所有SQL命令,要么把它们当作整体全部放弃。 3、事务永远不会只完成一部分。 4、事务可以由一条非常简单的SQL语句组成,也可以由一组复杂的SQL语句组成。在事务中的操作,要么都执行,要么都不执 阅读全文
posted @ 2022-12-01 17:50 小粉优化大师 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 1、用户管理 1.1、查询用户 use mysql -- 5.6以下的版本 select host,user,password from user; -- 5.7以上的版本 select host,user,authentication_string from user; 1.2、创建用户 1.2. 阅读全文
posted @ 2022-11-27 23:30 小粉优化大师 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 14.1、事件调度器使用场景 数据库管理是一项重要且烦琐的工作,许多日常管理任务往往会频繁地﹑周期性地执行,例如定期维护索引﹑定时刷新数据﹑定时关闭帐户﹑定义打开或关闭数据库等操作,实际应用中,数据库管理员会定义事件对象以自动化完成这些任务。本任务将详细介绍MySQL中事件调度的创建﹑维护和管理等。 阅读全文
posted @ 2022-11-25 11:14 小粉优化大师 阅读(138) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 18 下一页