机械类毕业设计代做网站推荐,建站方法,做产品展示网站,曲靖网站建设创建一个student表用于存储学生信息
CREATE TABLE student( id INT PRIMARY KEY, name VARCHAR(20) NOT NULL, grade FLOAT );
向student表中添加一条新记录 记录中id字段的值为1#xff0c;name字段的值为monkey#xff0c;grade字段的值为98.5
insert into …创建一个student表用于存储学生信息
CREATE TABLE student( id INT PRIMARY KEY, name VARCHAR(20) NOT NULL, grade FLOAT );
向student表中添加一条新记录 记录中id字段的值为1name字段的值为monkeygrade字段的值为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 test1localhost identified by 123;
grant select on db_system.* to test1localhost ;
查询用户test1的权限
show grants for test1localhost;
删除用户test1
drop user test1localhost;