如何只在少数列中插入数据,而使其他列为空或在mysql表记录中保留它们? [英] how to insert data in only few column leaving other columns empty or as they are in a mysql table record?
问题描述
我创建了一个名为学生"的表格.它具有以下字段:
I have created a table named 'students'. It has following fields :
roll_no <- type:Integer Not Null,
course_name <- type:varchar(40) Not Null,
std_surname <- type:varchar(40) Not Null,
std_firstname <- type:varchar(40) Not Null,
emailid <- type:varchar(40) ,
address <- type:varchar(40) Not Null,
income <- type:Integer,
gender <- type:varchar(10) Not Null,
experience <- type:Integer,
在上述字段中,有些接受空值,大多数不接受空值或不允许使用空值.
in the above fields mentioned some accept null values and most of them don't accept null values or null values are not allowed.
我想做的是将一些信息或数据插入不接受空值的列中,然后再将剩余的数据插入到其余的列中.我该如何实现?
What I want to do is I want to insert some information or data into the columns that do not accept null values and then I want to insert remaining data into the remaining columns later. How can I achieve this?
更具体地说,如何使用插入查询一次仅将少量数据插入记录中的特定字段,而将其他字段保留为空,然后插入其余字段值(如电子邮件或体验)?
More specifically how can I insert only few data into specific fields in a record at a time using insert query leaving other fields empty and then insert remaining field values like email or experience ???
请帮助我解决这个问题?
Please help me with this problem?
推荐答案
插入所选字段
前
INSERT INTO
students
(roll_no, course_name, dob, gender)
VALUES
(111, 'MBA', '1991-01-01', 'F');
用于插入NULL值, 看看
for inserting NULL values, have a look at
这篇关于如何只在少数列中插入数据,而使其他列为空或在mysql表记录中保留它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!