I created a table called Dummy
with 4 columns: Date, Year, Student_Names, Subject
.
After a few days I need to add one more column name called Marks
.
I know how to add column Marks
by using the SQL query, I am using the query below:
Alter Table Dummy
add Mark varchar(30)
After I add the column, all values are NULL, I need some value in the place of NULL.
How do I add those values? Values are mentioned in an Excel file.
Try,
Alter Table Dummy ADD Mark varchar(30) DEFAULT ''
or
UPDATE Dummy
SET [MArk] = 'new value'
your code is update Dummy set Marks = 10 where Student_Names = name you want to add marks to
like this you can add marks to all the students
good luck
You can update NULL values:
UPDATE Dummy
SET Mark = "none"
WHERE Mark is NULL
Will set all the marks to "none".
Also, when adding the column, you can specify a default value:
ADD Mark varchar(30) NOT NULL DEFAULT 'none'
要更新Excel工作表中的值,您需要在Excel文件中编写Query(使用CONCATENATE函数)并在表上运行它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.