L010 DW Lab7
L010 DW Lab7
L010 DW Lab7
PART A
(PART A : TO BE REFFERED BY STUDENTS)
A.1 Aim:
A.3 Outcome:
After successful completion of this experiment students will be able to
A.4 Theory:
For example, when data is copied from a word processing file to a database
application, the data format is changed from .doc or .txt to a .CSV or DAT
format. Usually, this process is performed through or the last phase of the
Extract, Transform and Load (ETL) process. The data is extracted from an
external source and transformed into the destination application's supported
format, where the data is further loaded.
The load phase loads the data into the end target, which can be any data
store including a simple delimited flat file or a data warehouse. Depending
on the requirements of the organization, this process varies widely. Some
data warehouses may overwrite existing information with cumulative
information; updating extracted data is frequently done on a daily, weekly,
or monthly basis. Other data warehouses (or even other parts of the same
data warehouse) may add new data in a historical form at regular intervals
— for example, hourly. To understand this, consider a data warehouse that
is required to maintain sales records of the last year. This data warehouse
overwrites any data older than a year with newer data. However, the entry
of data for any one year window is made in a historical manner. The timing
and scope to replace or append are strategic design choices dependent on
the time available and the business needs. More complex systems can
maintain a history and audit trail of all changes to the data loaded in the
data warehouse. As the load phase interacts with a database, the constraints
defined in the database schema — as well as in triggers activated upon data
load — apply (for example, uniqueness, referential integrity, mandatory
fields), which also contribute to the overall data quality performance of the
ETL process.
TASK 1:
PART B
(PART B : TO BE COMPLETED BY STUDENTS)
Students must submit the soft copy as per following segments within two hours of the practical.
The soft copy must be uploaded on the portal at the end of the practical. The filename should be
DS_batch_rollno_experimentno Example: DS_E7_E001_Exp7
Date of Grading:
Task 1:
Input:
Output:
Export without index
Export without index and different separator
Q1. Explain how to load csv file to MySQL database(Steps with an Code)?
To import a CSV file into a MySQL database, you can use the LOAD DATA INFILE
statement. This statement reads a text file and imports it into a database table.
Here are the steps to import a CSV file into a MySQL database using Workbench:
Install MySQL Workbench and connect to the database.
Create a blank table.
Import the CSV file.
Check the import results.
You can also import a CSV file into a MySQL database using the command line:
Access MySQL Shell.
Create a MySQL table for CSV import.
Import the CSV into the MySQL table.
The LOAD DATA INFILE statement specifies the location of the input CSV file and the
table into which data is to be populated. The statement looks like this:
LOAD DATA INFILE '{folder_structure}/{csv_file_name}' INTO TABLE table_name
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE
1 ROWS;
************************