如何在行中填充空值?

时间:2019-07-13 16:27:23

标签: mysql

enter image description here我做了一张桌子,然后在其中添加了一个列,现在所有行中的所有列值都为空

insert into students
 value  
('05','0005','fname','2000','m','fyit','1234567894','king5','332','500','624','650','CS','st','walk','email');

电子邮件应为空值。

1)

create database siws;
use siws;
    create table students
        (
            student_id int(2) AUTO_INCREMENT primary key,
            roll_no int(4),
            fullname char(10),
            dob int(4),
            gender char(1),
            class char(4),
            phone_no bigint(10),
            address varchar(20),
            ssc int(3),
            totssc int(3),
            hsc int(3),
            tothsc int(3),
            department char(2),
            caste char(4),
            travelling char(6)

);

2)

Insert into students
 value ('01','0001','aname','2000','m','syit','1234567890','king1','499','500','649','650','IT','open','bike');
 insert into students
 value ('02','0002','bname','2001','f','syit','1234567891','king2','497','500','639','650','CS','obc','cycle');
 insert into students
 value ('03','0003','cname','2002','m','fyit','1234567892','king3','437','500','629','650','IT','sc','car');
   insert into students
 value ('04','0004','dname','2002','f','syit','1234567893','king4','344','500','619','650','IT','open','plane');
   insert into students
 value ('05','0005','fname','2000','m','fyit','1234567894','king5','332','500','624','650','CS','st','walk');

3)

ALTER TABLE students
ADD Email varchar(255); //add column

很抱歉,这里有新的长码:)

1 个答案:

答案 0 :(得分:0)

要向存在的行中添加值,您需要更新

     Update students
     set email = 'youreamil@yexample.com'
     where student_id =5