|
The most common technique of performing data entry requires that you know the
sequence of columns of the table in which you want to enter data. With this
subsequent list in mind, enter the value of each field in its correct position.
During data entry on adjacent fields, if you don't have a value for a numeric
field, you should type 0 as its value. For a string field whose data you don't
have and cannot provide, type two single-quotes '' to specify an empty field.
|
Practical Learning: Performing Adjacent Data Entry
|
|
- To perform adjacent data entry, execute the following statement:
INSERT StaffMembers
VALUES
(
1,
'01-10-22',
'Hermine Lusack',
'(301) 726-2208',
108,
22.15,
1
);
|
- To perform other entries, execute the following statement:
INSERT StaffMembers VALUES
(2,'1996/05/18', 'Bertrand Koumah','(301) 726-2208',112,20.18,1);
|
- Execute the following statement:
INSERT INTO StaffMembers VALUES (
3, '2001-04-02','Valencia Nguyen', '(301) 726-2208', 118, 15.12, 0);
|
- Execute the following statement:
INSERT INTO StaffMembers
VALUES(4,'2004-2-04','Walter Hills',
'(301) 726-2212',112,
22.08,
1)
;
|
- Execute the following statement:
INSERT StaffMembers
VALUES
(5, '2002/07/3','Chris Lahren', '(301) 726-2208', 114, 16.72, 1);
|
- Execute the following statement:
INSERT StaffMembers
VALUES(6, '2001-5-10', 'Alexander Waters', '', 118, 14.15,0);
|
- Execute the following statement:
INSERT INTO StaffMembers
VALUES(7, '1999-7-04', 'James', '(301) 726-2208', 0,12.84, 0);
|
The adjacent data entry we have been using requires that you know the
position of each column. The SQL provides an alternative that allows you to perform
data entry using the name of a column instead of its position. This allows you to
provide the values of fields in any order of your choice.
To perform data entry at random, you must provide a list of the
columns of the
table in the order of your choice. You can either use all columns or provide a
list of the same columns but in your own order. In the same way, you don't have
to provide data for all fields, just those you want, in the order you want. To do this, enter the
names of the desired columns on the right side of the name of the table, in
parentheses. The syntax used would be:
INSERT TableName(ColumnName1, Columnname2, ColumnName_n)
VALUES(ValueFormColumnName1, ValueFormColumnName2, ValueFormColumnName_n);
|
Practical Learning: Performing Random Data Entry
|
|
- To enter data in an order of your choice, execute the following statement:
INSERT StaffMembers(FullName, Married, EmplNo, Ext, Salary, DateHired)
VALUES('Helene Maud', 1, 8, 115, 20.05, '2001-08-04');
|
- Execute the following statement:
INSERT INTO StaffMembers
(FullName, WorkPhone, EmplNo)
VALUES('Mark Rhoades', '(301) 726-2212', 9);
|
|
|