Exercise: Data Import and Export
Explore hands-on data import and export tasks using CSV, XML, JSON, and SQL dumps to manage MySQL databases. Learn to handle NULL values, format data exports, and optimize backup processes for database reliability.
We'll cover the following...
We will now proceed with the practical work.
Question 1
Given the structure of the Customers table below:
Field | Type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where CustomerID is the primary key and ReferralID is self-referencing to CustomerID. The table contains information about customers.
Consider a CSV file special_customers.csv where NULL for Phone is represented by N/A and for Address by an empty field.
CustomerName,Email,Phone,Address,CustomerTier"Test User One","test1@example.com","N/A","",New"Test User Two","test2@example.com","555-9900","77 Test Drv",Regular
Import this data into the Customers table, ensuring ‘N/A’ for phone becomes NULL ...