搜题
问题   更新时间2023/7/3 17:47:00

登入root账户并在student数据库中创建一个名为stuinfo的表,表中字段包括:Stuno、Stuname、Stubir、Stuage,其中Stuno为主键。

mysql -u root -p; USE student CREATE TABLE stuinfo (Stuno varchar(10) primary key, Stuname varchar (8), Stubir datetime, Stuage int); 操作结果为创建成功 (2)向stuinfo表中添加一条记录,使得对应字段分别为“2019211001”,“David”,“2002-02-05”,17。 答案:(3分) insert into stuinfo values(‘2019211001’,’David’,’2002-02-05’,17); 操作结果为插入成功 (3)向stuinfo表中添加一条记录,使得对应字段分别为“2019211001”,“Tina”,“2002-05-26”,17。 答案:(3分) insert into stuinfo values(‘2019211001’,’Tina’,’2002-5-26’,17); 操作结果为插入失败 (会显示:ERROR 1142 (42000): INSERT command denied to user 'dbnormal'@'localhost' for table 'stuinfo') (4)向stuinfo表中添加一条记录,使得对应字段分别为“2019211002”,“David”,“2002-02-05”,17。 答案:(3分) insert into stuinfo values('2019211002','David','2002-02-05',17); 操作结果为插入成功 (5)向stuinfo表中添加一条记录,使得对应字段分别为null,“David”,“2002-02-05”,17。 答案:(3分) insert into stuinfo values(null,’David’,’2002-02-05’,17); 操作结果为插入失败 (访问被拒绝:ERROR 1048 (23000): Column 'stuno' cannot be null)
王老师:19139051760(拨打)