Step one concerned creating an SQL database in SQL Server Administration Studio (SSMS) and loading buyer knowledge, together with:
- Demographics (age, gender, location)
- Cost Historical past (billing cycles, defaults)
- Service Utilization (subscription sort, engagement ranges)
- Churn Standing (Keep vs. Churned)
The dataset was structured throughout a number of tables, requiring SQL joins for evaluation. A database named db_Churn
was created, and the uncooked knowledge was imported right into a staging desk, stg_Churn
.
CREATE DATABASE db_Churn;
The dataset was imported as a CSV file into stg_Churn
, serving because the staging desk containing uncooked knowledge.
Encountered an error:
SELECT * FROM stg_Churn;
SQL Server returned an “Invalid object identify” error regardless of the desk being seen within the database.
Troubleshooting Steps Taken:
- Checked if the desk existed:
SELECT * FROM sys.tables WHERE identify = 'stg_Churn';
2. Verified the schema to make sure the desk was underneath dbo
.
3. Confirmed the database context:
USE db_Churn;
4. Used a completely certified desk identify:
SELECT * FROM db_Churn.dbo.stg_Churn;
5. Refreshed SSMS and reconnected to rule out short-term caching points.
Lesson Realized:
Explicitly defining the schema and making certain the right database context prevents question failures.
After resolving SQL points, important knowledge cleansing steps — resembling dealing with null values and changing lacking knowledge — had been utilized to stg_Churn
. A remaining production-ready desk, prod_churn
, was created for additional evaluation. Two views requiring SQL joins had been additionally created:
Views in SQL act as digital tables that present outcomes dynamically when queried. They’re notably helpful for simplifying advanced queries.