ASK Question

Quick links:
Latest articles
Internship
Members

Languages:
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL

Web:
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.

Programs:
C
C++
DS
Java
C#
Python


Aptitude:
C
C++
Java
DBMS

Interview:
C
Embedded C
Java
SEO
HR

CS Subjects:
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS

More:
Articles
Puzzles
News/Updates


Home » SQL

SQL - INSERT INTO Statement (to insert/add record into table)



SQL - INSERT INTO statement: In this article, we are going to learn everything about ‘INSERT INTO’ statement in SQL with syntax and examples.
Submitted by Shubham Singh Rajawat, on November 13, 2017

INSERT INTO statement is used to add/insert a new row into the table. There are two ways of using INSERT INTO.

1) To insert data in the specified columns of the new row/to insert a new record in the table

Syntax:

INSERT INTO table_name(column1, column2, ...) VALUES(value1, value2, ...);

Here,

  • table_name : name of the table into which we want to insert data.
  • column1, column2, ... : names of the columns/fields.
  • value1, value2, ... : values of the column/fields specified.

2) To insert data in all the columns/fields in the table

Syntax:

INSERT INTO table _name VALUES( value1, value2, ...);

Here,

  • table_name : name of the table into which we want to insert data.
  • value1, value2, ... : values of all the column/fields in the table.
SQL - insert into example

Example:

1) Insert a new record

INSERT INTO Student VALUES(5, 'Shubham','1998-12-16',88,87,78, 'Gwalior');

It will insert a new record in the table with Enroll_No:5, Student_name: Shubham, DOB: 1998-12-16 ...

SQL - Insert into example 1

2) Insert values in some specified columns

INSERT INTO Student ( Enroll_No, Student_name, city) VALUES (5, 'Shubham', 'Bhopal');

It will insert a new record in the table with Enroll_No:5, Student_name: Shubham, DOB: 1998-12-16 ...

SQL - Insert into example 1





Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com (2015-2018), Some rights reserved.