CINXE.COM
Adding Data to a Database
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="keywords" content="adding data to our database table, create, database management system, web based database, home, create, design"> <meta name="Description" content="Learn how to add data to a database table with this database tutorial."> <link rel="canonical" href="https://www.quackit.com/database/tutorial/adding_data_to_database.cfm"> <title>Adding Data to a Database</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <link rel="shortcut icon" href="/pix/favicon96.png"> <link rel="apple-touch-icon" href="/pix/apple-touch-icon.png"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet"> <link href="/common/css/master.45.min.css" rel="stylesheet"> <script async src="https://cdn.fuseplatform.net/publift/tags/2/3499/fuse.js"></script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-Q3H025ZKLN"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-Q3H025ZKLN'); </script> </head> <body> <header class="site-header"> <div class="site-header-base"> <div class="site-logo"> <a title="Quackit Homepage" target="_top" href="/"><img src="/pix/quackit_logo_watermark.png" width="87" height="33" alt="Quackit Logo"></a> </div> <button id="site-nav-toggler" class="site-nav-toggler" aria-expanded="false" aria-controls="site-nav"> <span class="sr-only">Toggle navigation</span> ☰ </button> </div> <nav id="site-nav" class="site-nav"> <div class="site-links"> <ul> <li><a href="/"><i class="fa fa-home"></i> <span class="sr-only">Home</span></a></li> <li><a href="/html/">HTML</a></li> <li><a href="/css/">CSS</a></li> <li><a href="/scripting/">Scripting</a></li> <li><a href="/database/">Database</a></li> </ul> </div> <div class="site-search-top"> <form action="/search/" id="cse-search-box-bottom" class="site-search"> <div> <input type="hidden" name="cx" value="partner-pub-6331358926293806:98x0fk-bbgi"> <input type="hidden" name="cof" value="FORID:10"> <input type="hidden" name="ie" value="ISO-8859-1"> <input type="text" name="q" size="20" class="site-search-input"> <button type="submit" name="sa" class="site-search-button"><i class="fa fa-search"></i></button> </div> </form> </div> </nav> </header> <div class="main"> <article class="content"> <h1 class="page-title">Adding Data to a Database</h1> <div class="ad ad-top"> <!-- GAM 71161633/QCKIT_quackit/article_header --> <div data-fuse="23059883623"></div> </div> <ul class="pager"> <li><a href="/database/tutorial/creating_database_tables.cfm"><i class="fa fa-long-arrow-left" aria-hidden="true"></i> Creating Database Tables</a></li> <li><a href="/database/tutorial/querying_a_database.cfm">Querying a Database <i class="fa fa-long-arrow-right" aria-hidden="true"></i></a></li> </ul> <p class="lead">There are a number of ways you can enter data into a database table. The method you choose will largely depend on your context.</p> <p>You can add data into a database using any of the following methods:</p> <ul> <li>Direct entry</li> <li>Form</li> <li>Import</li> <li>Structured Query Language (SQL)</li> <li>Website or other application</li> </ul> <div class="ad"> <!-- GAM 71161633/QCKIT_quackit/article_incontent_1 --> <div data-fuse="23059883629"></div> </div> <p>Here's an explanation of those methods.</p> <ul class="steps"> <li> <figure> <a target="_blank" data-lightbox="database_tutorial" href="/pix/database/tutorial/adding_data_to_database_1.png"><img src="/pix/database/tutorial/adding_data_to_database_1.png" class="screenshot steps" alt="Screenshot of a database table in Datasheet View."></a> <figcaption> <h3>Direct entry</h3> <p>You can type directly into the table while it's in Data Sheet view.</p> <p>Initially, this may seem like the quickest and easiest method, but it's not suitable if you have lots of data, and/or if non-technical users need to enter data.</p> </figcaption> </figure> </li> <li> <figure> <a target="_blank" data-lightbox="database_tutorial" href="/pix/database/tutorial/adding_data_to_database_2.png"><img src="/pix/database/tutorial/adding_data_to_database_2.png" class="screenshot steps" alt="Screenshot of a database form."></a> <figcaption> <h3>Form</h3> <p>If you use a desktop database program such as MS Access, you can set up a form, so that non-technical users can enter data into the form. Once they submit the form, the data is automatically inserted into the table. The form could insert data into multiple tables too - saving you from having to open up each table to manually insert the data.</p> <p>Most enterprise database systems don't have the ability for setting up a form. This is probably because they're designed for larger scale applications with hundreds, thousands, or even millions of users. In this environment, a form would be created through other means (for example, using <a href="/html/">HTML</a>).</p> <p>Applications such as Access provide a form wizard, which steps you through the process to building a form.</p> </figcaption> </figure> </li> <li> <figure> <a target="_blank" data-lightbox="database_tutorial" href="/pix/database/tutorial/adding_data_to_database_3.png"><img src="/pix/database/tutorial/adding_data_to_database_3.png" class="screenshot steps" alt="Screenshot of an SQL insert script."></a> <figcaption> <h3>SQL <code>INSERT</code> Statement</h3> <p>You can use SQL (Structured Query Language) to insert data. This is a common way of adding certain types of data across large systems, often within multiple environments.</p> <p>In fact, database developers often create SQL scripts that create a whole database, and insert data at the same time. They can re-use the same script in their development, test, and even the production environments.</p> <p>SQL scripts are commonly used to insert "lookup" data - this is generally a base set of data that never (or rarely) changes (such as countries, gender, etc). Running such a script will usually insert all records within seconds (or milliseconds).</p> </figcaption> </figure> </li> <li> <figure> <a target="_blank" data-lightbox="database_tutorial" href="/pix/database/tutorial/adding_data_to_database_4.png"><img src="/pix/database/tutorial/adding_data_to_database_4.png" class="screenshot steps" alt="Screenshot of the Import Wizard in Access 2016."></a> <figcaption> <h3>Import Data</h3> <p>Most database management systems allow you to import data from external sources. For example, you could import data from a CSV file, an Excel spreadsheet, or another database.</p> <p>The accompanying screenshot shows the import options available in Microsoft Access. Each option launches an "Import Wizard" that assists you in importing the data, either into an existing table, or a new one based on the new data.</p> </figcaption> </figure> </li> <li> <figure> <a target="_blank" data-lightbox="database_tutorial" href="/pix/database/tutorial/adding_data_to_database_5.png"><img src="/pix/database/tutorial/adding_data_to_database_5.png" class="screenshot steps" alt="Screenshot of an example HTML form."></a> <figcaption> <h3>Website or other Application</h3> <p>You could build an application that uses the database to store and retrieve data. The person entering the data doesn't need to have direct access to the database. They don't even need to have database software. By using SQL, your database could be part of a larger application - such as a website.</p> <p>This is how most client/server database systems (such as SQL Server, MySQL, etc) work. The database is kept separate to the application. In many cases, there are multiple applications using a single database.</p> <p>This is probably the most common method of adding data to a database. If you've ever registered with a website, your details would have been inserted into a database using this method. </p> </figcaption> </figure> </li> </ul> <ul class="pager"> <li><a href="/database/tutorial/creating_database_tables.cfm"><i class="fa fa-long-arrow-left" aria-hidden="true"></i> Creating Database Tables</a></li> <li><a href="/database/tutorial/querying_a_database.cfm">Querying a Database <i class="fa fa-long-arrow-right" aria-hidden="true"></i></a></li> </ul> </article> <div class="sidebar"> <nav> <ul> <li> <h3><a href="/database/tutorial/"><i class="fa fa-database"></i> Database Tutorial</a></h3> <ul> <li><a href="/database/tutorial/what_is_a_database.cfm">What is a Database?</a></li> <li><a href="/database/tutorial/database_management_systems.cfm">Database Management Systems</a></li> <li><a href="/database/tutorial/creating_a_database.cfm">Creating a Database</a></li> <li><a href="/database/tutorial/about_database_tables.cfm">About Database Tables</a></li> <li><a href="/database/tutorial/creating_database_tables.cfm">Creating Database Tables</a></li> <li><a href="/database/tutorial/adding_data_to_database.cfm">Adding Data to a Database</a></li> <li><a href="/database/tutorial/querying_a_database.cfm">Querying a Database</a></li> <li><a href="/database/tutorial/relational_database_design.cfm">Relational Database Design</a></li> <li><a href="/database/tutorial/nosql_databases.cfm">NoSQL Databases</a></li> <li><a href="/database/tutorial/database_driven_website.cfm">Database Driven Website</a></li> <li><a href="/database/tutorial/database_summary.cfm">Summary</a></li> </ul> </li> <li> <h3><a href="/database/"><i class="fa fa-database"></i> Other DB Tutorials</a></h3> <ul> <li><a href="/sql/tutorial/" title="Structured Query Language">SQL Tutorial</a></li> <li><a href="/sqlite/tutorial/" title="">SQLite Tutorial</a></li> <li><a href="/mysql/tutorial/" title="Open source DB management system">MySQL Tutorial</a></li> <li><a href="/sql_server/tutorial/" title="Microsoft SQL Server">SQL Server Tutorial</a></li> <li><a href="/microsoft_access/tutorial/" title="Microsoft Access">Access Tutorial</a></li> <li><a href="/mongodb/tutorial/" title="Document-store database for big data.">MongoDB Tutorial</a></li> <li><a href="/neo4j/tutorial/" title="Graph database management system for big data.">Neo4j Tutorial</a></li> </ul> </li> </ul> </nav> <div class="ad ad-left"> <!-- GAM 71161633/QCKIT_quackit/article_vrec_2 --> <div data-fuse="23059511712"></div> </div> </div> <div class="ads"> <div class="ad ad-right"> <!-- GAM 71161633/QCKIT_quackit/article_vrec_1 --> <div data-fuse="23059883626"></div> </div> </div> </div> <div class="searchbox-bottom"> <form action="/search/" id="cse-search-box-bottom" class="site-search"> <div> <input type="hidden" name="cx" value="partner-pub-6331358926293806:npmuvy-i8kk"> <input type="hidden" name="cof" value="FORID:10"> <input type="hidden" name="ie" value="ISO-8859-1"> <input type="text" name="q" size="30" class="site-search-input"> <button type="submit" name="sa" class="site-search-button"><i class="fa fa-search"></i></button> </div> </form> <script src="//cse.google.com/cse/brand?form=cse-search-box-bottom&lang=en"></script> </div> <footer> <p class="about"><a href="/"><i class="fa fa-home"></i> Home</a> | <a href="/about.cfm" rel="nofollow">About</a> | <a href="/contact.cfm" rel="nofollow">Contact</a> | <a href="/terms_of_use.cfm" rel="nofollow">Terms of Use</a> | <a href="/privacy_policy.cfm" rel="nofollow">Privacy Policy</a></p> <p>© Copyright 2000 - 2025 Quackit.com </p> </footer> <script src="/common/js/spectrum/spectrum.js"></script> <script src="/common/js/lightbox2-master/dist/js/lightbox.min.js" charset="utf-8"></script> <script> $(document).ready(function(){ $( "#site-nav-toggler" ).click(function() { $( "#site-nav" ).toggle( "slow" ); }); }); </script> <script> $(function(){var a=window.location.href;$(".sidebar nav a").each(function(){a==this.href&&$(this).closest("li").addClass("selected")})}); </script> </body> </html>