|
Unit 10 . Action queries (I) |
|
Make-Table queries. |
| A Make-Table query creates a new table with the records stored in one or more tables. They are usually used to create working tables (we create it for a determine task, for example to store the results of a complex query that is taking long to execute and that we will use in various reports, and when we are finished with the task we erase it). They can also be usefull to create export tables (extract data from a table to send it to someone or to make copies of our tables). And finally they are used to create history tables. To create a Make-Table query: Open a new query in design view. We add one or more tables from where we are going to extract the data to save in our new table. We design the query in the same way as a normal selection query, so that only the records we want to save in the new table will appear. Then, we drop down the Query menu and select the Make-Table Query... option.
or, we can drop down the list from the
The Make table
dialogue appears: |
|
We type the name of the new table in Table Name: box. We normally create the table in the same database (Current database option) but we can create it in another database, and in this case we will need to check the Another database: option and type the name of the database where the table should be made in the File Name: box. It needs to be the complete name including the complete path, and therefore it is easier looking for the database using the Browse... button; click on it and search for the database where we want to save the new table. Finally, click on the OK button and we return to the Query design:
The design window is the same as that of
a selection query, and in it we define the selection query in order to
obtain the data to be saved in the new table. The only difference is that
on the title bar, after query name, we can see the words Make
Table Query and if we open the query properties by clicking on
the
To see the data that
will be stored in the new table, before create it, click on the
Datasheet view type The Run query
option makes it so that the new table is made with the data obtained from
the query. To run the query click on the When we run a make-table query we are advised of this, and we are also advised when a table already exists with the same name as the new one. The fields in the new table are named as the headers of the query fields, and inherit the same data type as the source fields but they do not inherit the properties such as the primary key, indexes, etc...
|
|
|
| | | Page. 10.1 |
|
Legal warning: Authorised on-line use only. It is not allowed the use of these courses in companies or private teaching centres.
|
|
© aulaClic. All rights reserved. Reproduction in any form whatsoever is prohibited.
April-2006.
|