Command Discussion

  • The INSERT INTO clause indicates that you intend to add a row to a table.

  • Following the INSERT INTO clause, the user specifies the name of the table into which the data is to be inserted.

  • When data values are being entered in the same order the columns were created in there is no need to list the column names following the INSERT INTO clause. However, sometimes when a row is added, the correct ordering of column values is not known. In those cases, the columns being added must be listed following the table name in the order that the values will be supplied.

  • Following the keyword VALUES are the values to be added to one row of a table. The entire row of values is placed within parentheses. Each data value is separated from the next by a comma. The first value corresponds to the first column in the table; the second value corresponds to the second column in the table, and so on.

Example: When the EMPLOYEE table is first created, it has no employee data stored in it. Add the first record to the table, where the data values we have are as follows:

     EID = 101
     ENAME = Aster, John A.
     DEPT = MKT
     RANK = STAFF
     BENEFITS = FULL
     SALARY = 32000
You can create a record containing these values by entering this command:
     INSERT INTO EMPLOYEE
     VALUES (101,'Aster, John A.','MKT','STAFF','FULL',32000) ;

Quotes are placed around character values so Texis can distinguish data values from column names.

A new employee record gets added to the EMPLOYEE table, so that the table now looks like this, if this were the only row entered:

  EID  ENAME               DEPT   RANK   BENEFITS   SALARY

  101  Aster, John A.      MKT    STAFF  FULL       32000

Copyright © Thunderstone Software     Last updated: Jul 28 2017
Copyright © 2017 Thunderstone Software LLC. All rights reserved.