Database Reference
In-Depth Information
INTO clause
106
Name of table
to create
FIGURE 3-60a
Query to create a new table (Access)
mysql> CREATE TABLE SmallCust
-> (CustomerNum CHAR(3),
-> CustomerName CHAR(35),
-> Street CHAR(15),
-> City CHAR(15),
-> State CHAR(2),
-> Zip CHAR(5),
-> Balance DECIMAL(8,2),
-> CreditLimit DECIMAL(8,2),
-> RepNum CHAR(2) )
-> ;
Query OK, 0 rows affected (0.13 sec)
Command to create
the SmallCust table
mysql> INSERT INTO SmallCust
-> SELECT *
-> FROM Customer
-> WHERE CreditLimit<=7500
-> ;
Query OK, 6 rows affected (0.06 sec)
Command to insert
record s from the Customer table
with credit limits of less than
$7,500 into the SmallCust table
FIGURE 3-60b
Query to create a new table (for Oracle and MySQL)
After you execute this query, you can use the SmallCust table shown in Figure 3-61, which is just like
any other table you created using the CREATE TABLE command.
Name of table
Records inserted from
the query results
FIGURE 3-61
SmallCust table created by query
Search WWH ::




Custom Search