To better manage its information, data of a table is arranged
in a series of fields. Once a table contains information, you can review it.

Introduction to Data Entry

The columns of a table are used to
organize data by categories. Each column has a series of fields under the
column header. One of the aspects of a table is to display data that is
available for each field under a particular column. Data entry consists of
providing the necessary values of the fields of a table.

To perform data entry using SQL, use the INSERT
combined with the VALUES keywords. The primary statement uses the
following syntax:

INSERT TableName VALUES(Column1, Column2, Column_n);

Alternatively, you can use the INTO keyword
between the INSERT keyword and the TableName. This is
done with the following syntax:

INSERT INTO TableName VALUES(Column1, Column2, Column_n)

The TableName factor must be a valid name of an
existing table in the databaser.

The VALUES keyword indicates that you are ready
to list the values of the columns. The values of the columns must be
included in parentheses.

If the column is a BIT data type, you must specify one
of its values as 0 or 1.

If the column is to receive an
integer (int, bigint, smallint), you should
provide a valid natural number without the decimal separator.

If the
column is for a decimal number (float, real, decimal,
numeric), you can type the value with its character
separator (the period for US English).

If the column was created for a date or time data type
(date, time, or datetime2), make
sure you provide a valid date.

If the data type of a column is a string type, you
should include its entry between single quotes. For example, a shelf
number can be specified as 'HHR-604' and a middle initial can be given as
'D'.

In your Windows application, you can pass the INSERT
statement to a command object.

Adjacent Data Entry

The most common technique of performing data entry
requires that you know the sequence of fields of the table in which you
want to enter data. Here is an example:

The adjacent data entry
requires that you know the position of each column. To perform data entry in an order of your choice, you must provide
your
list of the fields of the table. You can
either use all columns or provide a list of the same columns. Here are examples:

To support record maintenance operations, the SQL provides the UPDATE keyword
that is used to specify the table on which you want to maintain the
record(s). The basic formula to use is:

UPDATE TableName
SET ColumnName = Expression

With this formula, you must specify the name of the
involved table as the TableName factor of our formula. The SET
statement allows you to specify a new value, Expression, for the
field under the ColumnName column.

Updating all Records

The primary formula of the UPDATE statement as introduced
on our formula can be used to update all records. Here is an example:

With this code, all records of the Videos table will have
their Rating fields set to a value of R.

Editing a Record

You must provide a way for the interpreter
to locate the record. To do this, you would associate the WHERE operator
in an UPDATE statement using the following formula:

UPDATE TableName
SET ColumnName = Expression
WHERE Condition(s)

The WHERE operator allows you to specify how the
particular record involved would be identified. It is very important, in
most cases, that the criterion used be able to uniquely identify the record. In
the above table, imagine that you ask the interpreter to change the released
year to 1996 where the director of the video is Rob Reiner. The UPDATE statement
would be written as follows:

UPDATE Videos
SET YearReleased = 1996
WHERE Director = 'Rob Reiner';

In the above table, there are at least two videos directed
by Rob Reiner. When this statement is executed, all video records whose director
is Rob Reiner would be changed, which would compromise existing records that did
not need this change. Therefore, make sure your WHERE statement would isolate
one particular record or only those that need to be updated. Here is an example
used to change the name of the director of a particular video: