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

相关推荐
xcjbqd0几秒前
SQL中视图能否嵌套存储过程_实现复杂自动化报表逻辑
jvm·数据库·python
听*雨声12 分钟前
软件设计师上午题5:数据库
数据库
hong781722 分钟前
阿里coding plan qwen3.6-plus 不支持图片上下文长度只有200K,问题出在哪?
linux·运维·数据库
Paxon Zhang1 小时前
MySQL 大师之路**数据库约束,表设计,CRUD**
android·数据库·mysql
HealthScience1 小时前
clinvar数据集说明
数据库·oracle
王的宝库1 小时前
【MySQL】主从复制原理详解:从 Binlog 到数据一致性
数据库·mysql
Vect__1 小时前
MySQL基本认知、库和表的操作
数据库·mysql
cyber_两只龙宝1 小时前
【Oracle】Oracle之DQL中SELECT的基础使用
linux·运维·服务器·数据库·云原生·oracle
老苏畅谈运维1 小时前
Oracle 在线表重定义:将非分区表转换为分区表的最佳实践
数据库·oracle
treacle田1 小时前
达梦数据库-达梦数据库中link链接访问oracle 19c/11g-记录总结
数据库·oracle·达梦 link访问oracle