数据库作业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';

相关推荐
爱可生开源社区17 小时前
2026 年,优秀的 DBA 需要具备哪些素质?
数据库·人工智能·dba
随逸17721 小时前
《从零搭建NestJS项目》
数据库·typescript
加号32 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
シ風箏2 天前
MySQL【部署 04】Docker部署 MySQL8.0.32 版本(网盘镜像及启动命令分享)
数据库·mysql·docker
李慕婉学姐2 天前
Springboot智慧社区系统设计与开发6n99s526(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库·spring boot·后端
百锦再2 天前
Django实现接口token检测的实现方案
数据库·python·django·sqlite·flask·fastapi·pip
tryCbest2 天前
数据库SQL学习
数据库·sql
jnrjian2 天前
ORA-01017 查找机器名 用户名 以及library cache lock 参数含义
数据库·oracle
十月南城2 天前
数据湖技术对比——Iceberg、Hudi、Delta的表格格式与维护策略
大数据·数据库·数据仓库·hive·hadoop·spark
Henry Zhu1232 天前
数据库:并发控制基本概念
服务器·数据库