Table of Contents
ToggleThe INSERT INTO statement in SQL is used to insert new records into a table. It can be written in two different ways. Let’s explore the syntax and examples.
You can write the INSERT INTO statement in the following two ways:
INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
INSERT INTO table_name VALUES (value1, value2, value3, ...);
CustomerID | CustomerName | ContactName | Address | City | PostalCode | Country |
---|---|---|---|---|---|---|
101 | Spice Bazaar | Rajesh Khanna | 12 MG Road | Mumbai | 400001 | India |
102 | Curry Junction | Priya Sharma | 45 Brigade Road | Bengaluru | 560001 | India |
103 | Heritage Textiles | Ankit Mehra | 7 Johari Bazaar | Jaipur | 302003 | India |
INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country) VALUES ('Golden Silk Emporium', 'Mohit Jain', '18 Charminar Area', 'Hyderabad', '500002', 'India');
INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country) VALUES ('Tea Gardens', 'Sunita Das', '22 Assam Road', 'Guwahati', '781001', 'India'), ('Heritage Handlooms', 'Neha Kapoor', '5 Lal Chowk', 'Srinagar', '190001', 'India');