To insert data into an existing SQL table, you can use "INSERT INTO" statement which insert new rows of data into an existing table.
"INSERT INTO" statement is used to insert data into an existing table.
Here's the syntax :
INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...);
Specify the table name after the "INSERT INTO" keyword. Specify column names in parenthesis after the table name. Specify the list of values to be inserted into each column after 'VALUE' keyword. It is essential to ensure that the number of values matches the number of columns specified.
1. As you can see in below image, [Product] table contains zero record. Let's add some data to this table.
2. Run below SQL statement that inserts new rows of data into [Product] table :
INSERT INTO [Product] ( [DepartmentID], [Name], [GroupName], [ModifiedDate] ) VALUES ('01', 'Mike', 'Group-A', '1900-01-01'), ('02', 'Joe', 'Group-B', '2000-01-01'), ('03', 'John', 'Group-C', '2023-01-01');
3. Above statement will insert 3 new records of data in the [Product] table.
That's it! You have successfully inserted new records of data in the [Product] table using T-SQL.
1. Right-click on the table you wish to insert data into under "Tables folder" >> Select "Edit Top 200 Rows".
2. The 'Edit Table Data' window will appear, allowing you to insert values into rows and then close it.
3. Below is an image showing 3 new records inserted into the [Product] table.
That's it! You have successfully inserted new records of data in the [Product] table using GUI.
The "INSERT INTO" statement in SQL is used to add new records or rows into a database table.
A statement INSERT is a SQL command used to insert data into a database table.
The "INSERT INTO" statement is used for adding new data rows into a specific table in a database.
An example of an insert statement would be: "INSERT INTO Customers (CustomerName, ContactName, City) VALUES ('CompanyA', 'John Doe', 'New York')".