Suppose you
want to track each employee??™s birth date with the employees table:
ALTER TABLE employees ADD COLUMN birthdate DATE;
The new column is placed at the last position of the table. However, you can also
control the positioning of a new column by using an appropriate keyword, including
FIRST, AFTER, and LAST. For example, you could place the birthdate column directly
after the lastname column, like so:
ALTER TABLE employees ADD COLUMN birthdate DATE AFTER lastname;
Whoops, you forgot the NOT NULL clause! You can modify the new column:
ALTER TABLE employees CHANGE birthdate birthdate DATE NOT NULL;
Finally, after all that, you decide that it isn??™t necessary to track the employees??™ birth
dates. Go ahead and delete the column:
ALTER TABLE employees DROP birthdate;
CHAPTER 28 ?– MYSQL STORAGE ENGINES AND DATATYPES 725
The INFORMATION_SCHEMA
Earlier in this chapter you learned that the SHOW command is used to learn more about
the databases found in the server, tables found in a database, and columns comprising
a table. In fact, SHOW is used for learning quite a bit about the server??™s configuration,
including user privileges, supported table engines, executing processes, and more.
The problem is, SHOW isn??™t a standard database feature; it??™s something entirely native
to MySQL. Furthermore, it isn??™t particularly powerful. For instance, it??™s not possible
to use the command to learn about a table??™s engine type.
Pages:
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833