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

相关推荐
XW96325826 分钟前
除湿机行业组织能力与人才地图报告
大数据·服务器·网络·数据结构·数据库·人工智能
Decay__2 小时前
PostgreSQL 性能调优方法论 —— pg_stat_statements、EXPLAIN ANALYZE、瓶颈定位流程与参数基线
运维·数据库·sql·postgresql
前端兰博4 小时前
分库分表
数据库
智能收银研究所4 小时前
收银系统选型对比:美团、客如云、拉卡拉、收钱吧各适合什么门店
java·前端·数据库
七夜zippoe6 小时前
金仓 Kingbase 安装与 Java 连接(保姆级):从装库到 JDBC 跑通全记录
java·数据库·jdbc·kingbase·金仓
stormsha7 小时前
中文路径让 MySQL 起不来:Failed to find valid data directory 与 Illegal byte sequence
运维·数据库·mysql
stormsha7 小时前
MySQL 报 `data directory has files in it`:初始化失败一次,之后就永久起不来
运维·数据库·mysql
YYYing.8 小时前
【Redis剑指offer系列 (一) 】Redis数据结构
数据库·redis·缓存·八股
csdn_aspnet9 小时前
使用 Docker 配置 PostgreSQL 和 pgAdmin 4
数据库·docker·postgresql·pgadmin4
真上帝的左手11 小时前
4. 关系型数据库-MySQL-原生集成 AI能力
数据库·人工智能·mysql·ai