Data load command for new record
A common question!
The LOAD
command is used to load data into a database, and the specific syntax may vary depending on the database management system (DBMS) you're using. Here are some common LOAD
commands for loading new records:
MySQL
LOAD DATA INFILE 'file_name' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';
file_name
: the name of the file containing the data to be loadedtable_name
: the name of the table where the data will be loadedFIELDS TERMINATED BY ','
: specifies the delimiter used to separate fields in the fileENCLOSED BY '\"'
: specifies the character used to enclose fields in the file (e.g., quotes)LINES TERMINATED BY '\n'
: specifies the character used to terminate lines in the file (e.g., newline)
PostgreSQL
COPY table_name FROM 'file_name' DELIMITER ',' CSV;
table_name
: the name of the table where the data will be loadedfile_name
: the name of the file containing the data to be loadedDELIMITER ','
: specifies the delimiter used to separate fields in the fileCSV
: specifies that the file is in CSV format
Microsoft SQL Server
BULK INSERT table_name FROM 'file_name' WITH (FORMATFILE = 'format_file_name');
table_name
: the name of the table where the data will be loadedfile_name
: the name of the file containing the data to be loadedformat_file_name
: the name of the format file that describes the structure of the data file
Oracle
LOAD DATA INFILE 'file_name' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';
file_name
: the name of the file containing the data to be loadedtable_name
: the name of the table where the data will be loadedFIELDS TERMINATED BY ','
: specifies the delimiter used to separate fields in the fileENCLOSED BY '\"'
: specifies the character used to enclose fields in the file (e.g., quotes)LINES TERMINATED BY '\n'
: specifies the character used to terminate lines in the file (e.g., newline)
Note that these are just a few examples, and the specific syntax may vary depending on the DBMS and the format of the data file. It's always a good idea to consult the documentation for your specific DBMS for more information on loading data.