, một số thông tin về người dùng ghé thăm. Bộ điều khiển này được hiển thị trong Ví dụ 24-3. Ví dụ 24-3. Các điều khiển AboutController nhưng bạn không muốn MySQL để làm bất cứ điều gì cho đến khi bạn đã hoàn tất văn bản thông thường được lưu trữ. | T22 CHAPTER 28 MYSQL STORAGE ENGINES AND DATATYPES Copying a Table It s a trivial task to create a new table based on an existing one. The following query produces an exact copy of the employees table naming it employees2 CREATE TABLE employees2 SELECT FROM employees An identical table employees2 will be added to the database. Sometimes you might be interested in creating a table based on just a few columns found in a preexisting table. You can do so by simply specifying the columns within the CREATE SELECT statement CREATE TABLE employees3 SELECT firstname lastname FROM employees Creating a Temporary Table Sometimes it s useful to create tables that will have a lifetime that is only as long as the current session. For example you might need to perform several queries on a subset of a particularly large table. Rather than repeatedly run those queries against the entire table you can create a temporary table for that subset and then run the queries against it instead. This is accomplished by using the TEMPORARY keyword in conjunction with the CREATE TABLE statement CREATE TEMPORARY TABLE emp_temp SELECT firstname lastname FROM employees Temporary tables are created just as any other table would be except that they re stored in the operating system s designated temporary directory typically tmp or usr tmp on Linux. You can override this default by setting MySQL s TMPDIR environment variable. Note As of MySQL ownership of the CREATE TEMPORARY TABLE privilege is required in order to create temporary tables. See Chapter 29 for more details about MySQL s privilege system. Viewing a Database s Available Tables You can view a list of the tables made available to a database with the SHOW TABLES statement mysql SHOW TABLES CHAPTER 28 MYSQL STORAGE ENGINES AND DATATYPES 723 ------------------------------- Tables_in_company ------------------------------- employees ------------------------------- 1 row in set sec Note that this is the standard methodology prior to .