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

相关推荐
北风toto17 分钟前
本体和智能体协同核心5步骤(生成sql语句)
数据库·sql
IvorySQL19 分钟前
PostgreSQL 技术日报 (6月10日)|多工具版本更新,PG19 图语法落地
数据库·postgresql
lsyeei24 分钟前
数据库分库分表
数据库
这个DBA有点耶27 分钟前
Vibe Coding 是什么?当“感觉编程”遇上数据库
数据库·人工智能·架构·学习方法·ai编程·程序员创富·改行学it
数智化精益手记局38 分钟前
拆解项目管理平台核心功能:看项目管理平台如何解决跨部门协作难题与多项目并行场景
大数据·运维·数据库·人工智能·产品运营
da-peng-song1 小时前
ArcGIS Desktop使用入门(三)图层右键工具——定义查询
数据库·arcgis·拆分数据·定义查询
热爱正能量1 小时前
数据库死锁排查思路
数据库
swordbob2 小时前
MySQL和Oracle关于读未提交的区别
数据库·mysql·oracle
林九生2 小时前
【实用技巧】MySQL 绿色版一键路径更新脚本详解 —— update_path.bat 深度解析
android·数据库·mysql
野生技术架构师2 小时前
从 B+ 树到应用层分表:MySQL 海量数据架构解析
数据库·mysql·架构