Step-by-Step Instructions
Step-by-Step Instructions
Create a Database:
Right-click on Tables under your newly created database > New Table.
Design the schema for tables like Customer, Transaction, and Interaction.
Example schema for Customer table:
sql
Copy code
CREATE TABLE Customer (
CustomerID INT PRIMARY KEY,
FirstName NVARCHAR(50),
LastName NVARCHAR(50),
Email NVARCHAR(100),
PhoneNumber NVARCHAR(15),
DateJoined DATETIME
);
Example schema for Transaction table:
sql
Copy code
CREATE TABLE Transaction (
TransactionID INT PRIMARY KEY,
CustomerID INT FOREIGN KEY REFERENCES Customer(CustomerID),
TransactionAmount DECIMAL(10, 2),
TransactionDate DATETIME
);
Example schema for Interaction table:
sql
Copy code
CREATE TABLE Interaction (
InteractionID INT PRIMARY KEY,
CustomerID INT FOREIGN KEY REFERENCES Customer(CustomerID),
InteractionType NVARCHAR(50),
InteractionDate DATETIME
);
Step 3: Populate the Database
Insert Data:
Write SQL queries to insert some initial data into the tables.
Example data insertions:
sql
Copy code
INSERT INTO Customer (CustomerID, FirstName, LastName, Email, PhoneNumber,
DateJoined)
VALUES (1, 'John', 'Doe', '[email protected]', '123-456-7890', GETDATE());
Select Data:
sql
Copy code
SELECT * FROM Customer;
Join Tables:
sql
Copy code
UPDATE Customer
SET PhoneNumber = '987-654-3210'
WHERE CustomerID = 1;
Week 2: Data Warehousing and Python Programming
Step 1: Data Warehouse Implementation
sql
Copy code
CREATE TABLE CustomerSummary (
CustomerID INT PRIMARY KEY,
TotalTransactions INT,
TotalAmountSpent DECIMAL(10, 2)
);
Step 2: Load Data into Data Warehouse
engine = create_engine('mssql+pyodbc://username:password@server/database?
driver=SQL+Server')
query = 'SELECT * FROM Customer'
df = pd.read_sql(query, engine)
print(df)
Week 3: Data Science and Azure Integration
Step 1: Data Science with Python
df['TransactionAmount'].hist()
plt.show()
Step 2: Build Predictive Models
model = RandomForestClassifier()
model.fit(X_train, y_train)
Step 3: Azure Data Services Integration
python
Copy code
import mlflow
mlflow.start_run()
mlflow.log_param("model_type", "RandomForest")
mlflow.log_metric("accuracy", 0.95)
mlflow.end_run()
Step 2: Deploy the Model
@app.route('/predict', methods=['POST'])
def predict():
data = request.get_json()
# Perform prediction logic
return jsonify(prediction=prediction_result)
if __name__ == '__main__':
app.run(debug=True)
Step 3: Prepare Final Report and Presentation
Prepare slides showing the database design, Python integration, data analysis, and
final deployment.