Prev | Current Page 416 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"

In that case, the order of values must be the order of columns in the table.
Here is another example:
INSERT INTO Student VALUES ('Mark Hopkins', 'Williams', 399,
'585 223 2533', 'Math', 'William Deal');
With data in the database, changing the information requires one to use the UPDATE statement. Here is the
syntax for UPDATE:
UPDATE
SET = , = ...,
=
WHERE ;
And here is an example:
UPDATE Student
SET Major = 'English', MajorAdvisorName = 'Ann Carroway'
WHERE Sname = 'Mary Poppins';
Mary has discovered her major field, and this statement will add that information to the row for Mary in
the Student table.
The WHERE clause in the UPDATE statement is the same as, and has all the power and flexibility of,
the WHERE clause in the SELECT statement. One can even use subqueries within the WHERE clause. The
WHERE clause identifies the rows for which column values will be changed. In this example, only one row qualified,
but in other cases the UPDATE statement can change whole groups of rows.
For instance, suppose the Computer Science department changes its name to Information Technology
department. The following UPDATE statement will change all Faculty rows that currently show Computer
Science as the department, so that they will now show Information Technology:
UPDATE Faculty
SET Dept = 'Information Technology'
WHERE Dept = 'Computer Science';
This one statement corrects all appropriate rows.


Pages:
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
mapa gify Everest Poker Bonus Kod regaƂy Bank kredyt hipoteczny Dyskusja Nr6