Home » SQL

SQL query to add values in column

In this article, we are going to learn about a SQL query to add the values in the table columns.
Submitted by Manu Jemini, on March 14, 2018

This one of the most common thing we do in the database. So, let’s dive into it. The Column is declarative concept of how and what value can be stored in the record. For example, in the example given below, we have three columns id, name, address. So, every record will be inserted and selected by these names.

This example is about the insertion of a record in the database. The First thing you should take care of is table name and its fields.

So, to insert a record, simply say to your database that: insert into the table(name of the table) and then give values to it.

The Order of fields you will give in the query should be same as the values.

Table (employee) having three fields and four data in it,

    Id		Name		Address

    100		Aman		Mumbai
    200		Arun		Pune
    300		Karan		Delhi
    400		Aman		Mumbai

In above table, we have three columns in table employee which have four rows of data in it and we need to is to create an insert query to add data in these columns, so we use insert into with values to add those values in columns. Then the last thing we need to do is to show the change in data by printing it on the console.

Query1:

INSERT INTO employee(id,name,address) 
VALUES (500,'Sumit','Indore');

Query to display records:

SELECT * FROM employee;

Output

SQL query to add values in column




Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.