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

相关推荐
ClouGence9 小时前
Oracle CDC 架构优化:从主库直连到 DataGuard 备库同步
数据库·后端·oracle
无响应de神11 小时前
三、用户与权限管理
数据库·mysql
麦聪聊数据1 天前
数据服务化时代:企业数据能力输出的核心路径
数据库
shushangyun_1 天前
2026年快消品B2B系统推荐:支持终端门店订货、促销政策自动化的工具?
java·运维·网络·数据库·人工智能·spring·自动化
DARLING Zero two♡1 天前
【MySQL数据库】数据类型与表约束
数据库·mysql
曹牧1 天前
Oracle EXPLAIN PLAN
数据库·oracle
BD_Marathon1 天前
SQL学习指南——视图
数据库·sql
活宝小娜1 天前
mysql详细安装教程
数据库·mysql·adb
贤时间1 天前
codex 助力oracle ebs 开发
数据库·oracle
秉承初心1 天前
PostgreSQL 数据性能瓶颈突破实战
数据库·postgresql·oracle