ECommerce Technology

What is a network - Why Have Networks? - Network Types - Network Design - Network Topology - Intranet and Extranet

 

 Site Map :: Search ::Contact Us

ECommerce >> Database Connectivity


INSERT

 

The INSERT statement is used to add rows to a table. There are two variations on how the INSERT statement can be used. The first way allows you to add one new row to the table using a set of specified values. The second way uses a SELECT query and allows you to add multiple rows to a table. This variation is known as INSERT SELECT.

 

Inserting a single row

 

To insert a row into a table you must specify the table name and a list of values to insert into the table, as follows:

 

Example:

 

INSERT INTO tblAddressBook

VALUES

('121',

'Stephen Smith',

'24',

'45 Great Eastern Road, Glasgow',

'G1A 1BA',

'0123 456 7890',

'stephen@123abc.co.uk',

NULL)

 

This example will insert a single row into a table. The values to store are provided in the VALUES clause, and a value must be provided for every field. If there is no value to enter for a field, NULL should be entered, as has been done above for the MobilePhone field. This method of using INSERT is relatively simple but in general should be avoided. This is because the order of the values you have entered must match the order of the fields (also referred to as columns) in the table. If the order of the columns changes then it will break your SQL code.

 

Therefore, the following syntax should be used, where both the field names and the values for those fields are specified:

Web Server Software - Server Performance - Mapping - Performance Monitoring - Load Testing - Virtual  Directories and Aliases - Portability - What is a Protocol? - HOW FTP WORKS - HTTP - SHTTP - Telnet - Security for Commerce on the Internet

©2005 eCommerce Technology. All rights reserved