Using QMF

I. -- Insert rows into a table

To insert one or more rows into a table, put the operator I. under the table name and the values you want to insert under their respective columns. Each row you want to insert must contain the I. operator.

If you leave a blank under a column, or omit a column from the example table, a null value is inserted in that column in the database. You must specify values for all columns that are defined as NOT NULL.

You can insert rows into a table you created or into a copy of a table someone else created.rows that are created by someone else (You need authorization to create or copy a table.) To copy the Q.STAFF sample table, for example, enter DISPLAY Q.STAFF. When Q.STAFF displays, enter SAVE DATA AS PERS. The examples using I. assume that you created (or copied) a table and called it PERS.

This query inserts two rows into the PERS table:



PERS | ID  | NAME     | DEPT | JOB   | YEARS | SALARY   | COMM   |
-----+-----+----------+------+-------+-------+----------+--------|
I.   | 400 | HARRISON | 20   | SALES |       | 18000.66 | 0      |
I.   | 455 | STONER   | 17   |       |       | 19000.00 | 540.00 |

This query inserts date and time values in a table called TEST.DATETIME:



TEST.DATETIME | SMALLINTEGER |     DATE     |    TIME    |
--------------+--------------+--------------+------------|
I.            |              | '1987-11-11' | '14.22.00' |

If authorized, you can copy rows from one table to another using I.. In the query below, the example elements show which columns the query copies from Q.STAFF into PERS. The DEPT column in Q.STAFF is duplicated; one DEPT column contains a condition that limits one set of rows to those from Department 38. The YEARS column is also duplicated; one YEARS column contains a condition that limits the second set of rows to those with YEARS > 10. If employees in Department 38 have more than ten years of experience, they are in the report twice.



Q.STAFF | ID  | NAME | DEPT | DEPT | JOB | YEARS | YEARS |
--------+-----+------+------+------+-----+-------+-------|
        | _I1 | _N1  | _D1  | 38   | _J1 | _Y1   |       |
        | _I2 | _N2  | _D2  |      | _J2 | _Y2   | >10   |
 
 
PERS | ID  | NAME | DEPT | JOB | YEARS |
-----+-----+------+------+-----+-------|
I.   | _I1 | _N1  | _D1  | _J1 | _Y1   |
I.   | _I2 | _N2  | _D2  | _J2 | _Y2   |

A CONDITIONS box containing the conditions _D1 = 38 and _Y2 > 10 could be used instead of duplicating the DEPT and YEARS columns.

Rules for I.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]