0

Hello everyone,I have a question concerning sql language,how to add a constant to a column of integers in a table?

5th May 2017, 11:25 PM
As Mae
As Mae - avatar
7 Antworten
+ 6
do you mean a default value?
6th May 2017, 12:10 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 6
try this: (this is an example) CREATE TABLE person ( id int NOT NULL, name varchar(255), age int DEFAULT 18 ); here is a link for more information: https://www.w3schools.com/sql/sql_default.asp
6th May 2017, 12:17 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 6
If you want to change all the values in a column use the UPDATE command: UPDATE table_name SET column_name = 10;
6th May 2017, 12:30 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 6
your welcome
6th May 2017, 12:42 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
yes
6th May 2017, 12:11 AM
As Mae
As Mae - avatar
+ 1
I already created the table and I have a column of integers with different values n I want to add to each of these values 10 how can I do it?
6th May 2017, 12:20 AM
As Mae
As Mae - avatar
+ 1
thank you a lot Ulisses Cruz
6th May 2017, 12:35 AM
As Mae
As Mae - avatar