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

相关推荐
l1t2 小时前
DeepSeek 4.1总结的Tom Lane 谈塑造 Postgres 三十年历程的架构决策
开发语言·数据库·postgresql·架构
星云API|微信接口开发4 小时前
企业微信二次开发实战笔记:如何用在线调试快速验证接口功能
数据库·笔记·企业微信
隔窗听雨眠9 小时前
记一次SQL Server数据库性能分析:从CPU100%到单配置修复的完整诊断
开发语言·数据库·php
samson_www10 小时前
Oracle数据泵拷贝表空间
数据库·dba
呆萌很10 小时前
MySQL 8.4 LTS 完整安装教程
数据库·mysql
天空'之城11 小时前
单片机基础核心知识点汇总(三十三)
数据库·单片机·嵌入式硬件
爱吃苹果的日记本12 小时前
数据结构第一课
c语言·数据结构·数据库·学习·c#
张小姐的猫13 小时前
【AI大模型接入SDK】 —— Gemini接入封装
android·数据结构·数据库·c++·人工智能·python
Thomas214313 小时前
mysql 索引面试复习
数据库·mysql·面试