数据库作业day3

创建一个student表用于存储学生信息

CREATE TABLE student( id INT PRIMARY KEY, name VARCHAR(20) NOT NULL, grade FLOAT );

向student表中添加一条新记录 记录中id字段的值为1,name字段的值为"monkey",grade字段的值为98.5

insert into student (id,name,grade) values('1','monkey','98.5');

向student表中添加多条新记录 2,"bob",95.5 3,"john",90.0 4,"smith",88.5

insert into student (id,name,grade) values('2','bob','95.5'),('3','john','90.0'),('4','smith','88.5');

向student表中添加一条新记录,部分数据插入 5,"jone"

insert into student (id,name) values('5','jone');

更新表,grade 大于90的加0.5

update student

set grade = grade + 0.5

where grade > 90;

删除成绩为空的记录

delete from student

where grade is null;

用户权限

创建一个用户test1使他只能本地登录拥有查询student表的权限

reate user test1@'localhost' identified by '123';

grant select on db_system.* to test1@'localhost' ;

查询用户test1的权限

show grants for test1@localhost;

删除用户test1

drop user test1@'localhost';

相关推荐
段一凡-华北理工大学3 分钟前
向量数据库实战:选型、调优与落地~系列文章03:向量相似度算法全解:余弦、欧氏、内积,到底该用哪个?
大数据·数据库·人工智能·算法·机器学习·向量相似度·高炉炼铁
ClouGence1 小时前
CloudDM 数据库管理平台,全新 UI,更清晰、更高效!
数据库·开源
花生了什么事o3 小时前
DDD:领域驱动设计的初步认识
java·数据库
BGK1123583 小时前
基于qemu_v8+optee 4.00 平台构建 ca/ta
java·大数据·数据库
何中应4 小时前
Spring Boot整合Doris
java·数据库·spring boot
J-Tony114 小时前
【Redis】数据结构&&持久化
数据结构·数据库·redis
KaMeidebaby4 小时前
卡梅德生物技术快报|原核膜蛋白表达优化实操手册,膜蛋白的纯化梯度洗脱完整流程
前端·网络·数据库·人工智能·算法
Summer-Bright4 小时前
深度 | Agent 协议标准化:一场决定了 AI 经济底层规则的基础设施战争
java·数据库·人工智能·ai
我叫张小白。5 小时前
LangChain 结构化输出(Structured Output)技术文档
java·数据库·langchain
吴声子夜歌5 小时前
MongoDB 4.x——数据模型
数据库·mongodb