Search⌘ K
AI Features

Question: Export JSON Data

Understand how to export JSON data from a MySQL database by writing queries that select specific customer fields and save results as JSON files. Learn to handle self-referencing tables and filter VIP customer data for external use.

Question

Given the following structure of the Customers table:

Field

Type

CustomerID

int

CustomerName

varchar(50)

Email

varchar(50)

Phone

varchar(15)

Address

varchar(100)

LastLogin

date

CreatedAt

timestamp

CustomerTier

enum('New','Regular','VIP')

ReferralID

int

LoyaltyPoints

int

LastPurchaseDate

date

IsChurnRisk

tinyint(1)

Where, CustomerID is the primary key and ReferralID is self-referencing to CustomerID. The table contains information about customers. The table includes a Boolean column IsChurnRisk, which indicates whether a ...