Get the App
SLTechnology News&Howtos  ›  Database  › 

External table of Dameng database

Shulou Source: shulou.com Published: 2022-06-01 22:09:15 09月14日 Update

An external table is a table that does not exist in the database. By providing Damon with metadata that describes external tables, we can access an operating system file as if it were a read-only database table, as if the data were stored in a normal database table. External tables are an extension of database tables.

The process of creating a simple external table of dreams:

1. Assume that external data is in test.txt

[dmdba@localhost ~] $cat test.txt

1,2,3

4,5,6

two。 Write the control file test.ctl of the external table

[dmdba@localhost ~] $cat test.ctl

LOAD DATA

INFILE'/ home/dmdba/test.txt'

INTO TABLE TEST

FIELDS','

3. Create external table test

SQL > create external table test (C1 int,c2 int,c3 int) from'/ home/dmdba/test.ctl'

4. Validate external table data

SQL > select * from test

Line number C1 C2 C3

1 1 2 3

2 4 5 6

Tags: Data database file normal operating system system process direction line number storage control verification Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker OPPO Reno Redmi Xiaomi MariaDB