Logo
Home More Free Tutorials Educational Resources

SQL Insert

The SQL insert command is used to insert data into your SQL database. Our SQL tutorial teaches you SQL commands. It covers the insert, create, join,� import, retrieve, order, update, and delete commands.

Table of Contents

Inserting Rows

You can insert new rows into a table by using Scalable SQL.

Syntax:

Insert into tablename ( fieldname, fieldname, fieldname)
values ( value, value, value);

Explanation:

  • When inserting data, use the Start Transaction command so that any errors can be rolled back.
  • You must specify the values to be inserted.
  • When performing an insert, enclose character values in single quotes.
  • Do not enclose numeric values in single quotes.
  • Use the Rollback Work command to undo changes.
  • Use the Commit Work command to finalize changes.
Example:

Insert the following vendor into the TrnVendor table.

Vendor Id: TV055
Name: Party Games
Address: PO Box 136
City: Chicago
State: IL
Current Balance: 2498.62

  1. To start the transaction, type:

Start transaction;

  1. To insert the records, type:

Insert into TrnVendor (VendId, Name, Addr1, City, State, 
CurrBal )
values ( 'TV055', 'Party Games', 'PO Box 136', 'Chicago', 'IL', 2498.62);

  1. To view the record, type:

Select VendId, Name, Addr1, City, State, CurrBal [-ZZZ,ZZZ.99]
from TrnVendor
where VendId = 'TV055';

  1. To roll back your work, type:

Rollback work;

 

Table of Contents
Our Free Tutorials Word Basics 2007 Word Basics 2003/2002 Word Basics 97 Excel Basics 2007 Excel Basics 2003/2002 Excel Basics 97 PowerPoint Basics Windows Vista Tutorial Windows XP Tutorial Windows 98 Tutorial Scalable SQL -- A Tutorial RealSlideshow for RealPlayer Guide to Paint Shop Pro Flash Photoshop
Google
Web
www.baycongroup.com

Online Learning University of Phoenix - Obtain a Degree in Information Technology Online or on Campus. Click Here! The Art Institute of Pittsburgh -- Online Division - Learn Graphic Design Online. Click Here! DeVry University - Earn a Bachelor's Degree Online or on Campus. Click Here!
 
 
 
Legal Privacy
Copyright©1999-2008 Baycon Group, Inc. All Rights Reserved