This article was written by Travis Boylls. Travis Boylls is a Technology Writer and Editor for wikiHow. Travis has experience writing technology-related articles, providing software customer service, and in graphic design. He specializes in Windows, macOS, Android, iOS, and Linux platforms. He studied graphic design at Pikes Peak Community College.
This wikiHow teaches you how to insert values into a database using SQL. SQL is a programming language used to communicate with a SQL database. SQL databases store data in tables. Each table has a set of rows and columns that represent data. You can use an insert statement to add new data to a SQL database.
Steps
-
1Connect to your database. You can connect to your database using a variety of programs. This includes MySQL Workbench, Java, the command prompt or terminal, or a text document that you intend to upload to a server later on.
-
2Type INSERT INTO. This statement indicates that you are inserting new data into a table.[1]Advertisement
-
3Type the table name after the "INSERT INTO" command. For example, the table name is "Customers", you would type INSERT INTO Customers.
-
4Type the column names in parentheses after the command. If you have a database of all your customers, column names may include "First_Name", "Last_Name", "Email", "Phone", "Address". Separate each column name with a comma. In this example, your first statement would look something like this: INSERT INTO Customers (First name, Last name, Email, Phone)
- If you are adding data to every row in a table, you do not need to list the column names after the "INSERT INTO table_name" statement.
-
5Press ↵ Enter. This creates a new line below your first statement.
-
6Type VALUES. This second line is where you will input the actual data for each column in the table.
-
7Type the data for each column in parentheses. This data is the values. Place each value with apostrophes. Separate each value with a comma. Your entire Insert statement should look something like this:[2]
INSERT INTO Customers (First_Name, Last_Name, Email, Phone) VALUES ('John', 'Doe', 'Johndoe@email.com', '1-999-123-4567')
Advertisement
About This Article
1. Type "INSERT INTO".
2. Type the table name after the "INSERT INTO" statement.
3. Type the column names in parentheses after the table name.
4. Separate each table name with a comma.
5. Type "VALUES" on a separate line.
6. Type each value for each coumn name in parenthesis after "VALUES".
7. Place each value within apostraphes.
8. Separate each value with a comma




























































