# Drop table

透過 drop table 陳述式，可以隨時在指令碼執行期間，從資料模型和記憶體捨棄一或數個 Qlik Sense 內部表格。 選擇性地，在指令碼執行結束之前，使用 drop mapping table 變體來捨棄對應表格，亦即那些使用 Mapping 前置詞建立的內容。

drop [mapping] table tablename {, tablename2 ...}

drop [mapping] tables tablename {, tablename2 ...}

資訊備註同時接受表格 drop table 與 drop tables。

這將導致遺失下列項目：

* 實際的表格。
* 不屬於其餘表格的所有欄位。
* 其餘欄位中的欄位值，這些值完全來自已卸除的表格。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/drop-table.htm)

#### 範例與結果：

| 範例 | 結果 |
| --- | --- |
| ```<br>drop table Orders, Salesmen, T456a;<br>``` | 此行會導致從記憶體中卸除三個表格。 |
| ```<br>Tab1:<br>Load * Inline [<br>Customer, Items, UnitPrice<br>Bob, 5, 1.50<br>];<br> <br>Tab2:<br>LOAD Customer, Sum( Items * UnitPrice ) as Sales<br>resident Tab1<br>group by Customer;<br> <br>drop table Tab1;<br>``` | 建立表格 Tab2 後，即會卸除表格 Tab1。 |
| ```<br>// Load mapping table of country codes:<br>map1:<br>mapping LOAD *<br>Inline [<br>CCode, Country<br>Sw, Sweden<br>Dk, Denmark<br>No, Norway<br>] ;<br>// Load list of salesmen, mapping country code to country<br>// If the country code is not in the mapping table, put Rest of the world<br>Salespersons:<br>LOAD *,<br>ApplyMap('map1', CCode,'Rest of the world') As Country<br>Inline [<br>CCode, Salesperson<br>Sw, John<br>Sw, Mary<br>Sw, Per<br>Dk, Preben<br>Dk, Olle<br>No, Ole<br>Sf, Risttu] ;<br>// We don't need the CCode anymore<br>Drop Field 'CCode';<br>									<br>Drop Mapping Table map1;<br><br>Metrics:<br><br>Load * Inline [<br>Transaction ID, Sales Amount, Sales Cost, City, Customer ID<br>1000012, 4509.33, 1234.22, Oslo, 250v9849<br>1000013, 1043.21, 180.23, Gothenburg, 195d5930<br>1000014, 6038.35, 1400.10, Copenhagen, 195d5930<br><br>];<br>``` | 此範例顯示如何使用 Drop mapping table 變體。建立對應表格 map1，然後在後續的 LOAD 陳述式中與 ApplyMap 函數一起使用。使用對應表格後，會將其從記憶體中卸除，從而最佳化指令碼執行後續表格中要載入之資料的 RAM 使用量。<br><br>在此情況下，由於對應表格中只有幾列，因此 RAM 最佳化效果微乎其微。但是，對於大型對應表格或在迴圈內建立對應表格時，效能可以顯著提升。 |

[Rename table](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/rename-table.htm)

[Drop field](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/drop-field.htm)

[Drop](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/Drop.htm)

[Table/Tables](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/Table.htm)

[對應](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes/Mapping.htm)