Prev | Current Page 415 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"

Having created the tables for a database, the next step will be to
enter data. The SQL statement for adding rows to a table is INSERT. Here is the syntax for INSERT:
INSERT INTO ( , ..., )
VALUES( , ..., );
This says that the key words INSERT INTO must be followed by the name of a table. Then you must
provide an open parenthesis, a list of one or more column names, and a close parenthesis. Then the key word
VALUES must appear, followed by an open parenthesis, a list of column values corresponding to the column
names, a closed parenthesis and a semicolon.
And here is an example:
INSERT INTO Student( Sname, Dorm, Room, Phone )
VALUES ('Mary Poppins', 'Higgins', 142, '585 223 2112');
154 DATABASE [CHAP. 8
In this example, notice that some columns are not specified. This student has not yet declared a major.
The values for the unspecified columns (Major, MajorAdvisorName) will be null.
The order of column names need not be the same as the order of the columns in the table, but
the order of the values in the VALUES clause must correspond to the order of columns in the INSERT
statement.
In the common case that every column will receive a value, it is not necessary to include the list of column
names in the INSERT statement.


Pages:
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
Apartamenty nad morzem online loan for bad credit Powiększanie ust kraków Noclegi Władysławowo Noclegi Rowy