Week 5
Teaching and Learning Methods to be Employed
1. Interactive lecture with live SQL demonstrations in MySQL
2. Hands-on SQL lab session — students write and execute queries
3. Pair programming: SQL query challenges
4. Real dataset exercise using Nigerian banking/demographic sample data
Learning Outcomes / Objectives
By the end of this week, students should be able to:
1. Write SQL DDL statements to create and alter tables.
2. Write SQL DML statements to insert, update, and delete data.
3. Write SQL SELECT queries with WHERE, ORDER BY, and LIMIT clauses.
4. Apply SQL aggregate functions (COUNT, SUM, AVG, MIN, MAX) with GROUP BY and HAVING.
5. Write SQL JOIN queries to combine data from multiple tables.
6. Write basic subqueries.
5.3 Data Manipulation Language (DML)
5.3.1 INSERT
INSERT INTO CUSTOMER (BVN, FirstName, LastName, PhoneNumber, LGA, State, AccountType, DateOpened, Balance)
VALUES ('12345678901', 'Abdulrahman', 'Musa', '08012345678', 'Chanchaga', 'Niger State', 'Savings', '2024-01-15', 50000.00);
5.3.2 UPDATE
-- Give all Savings account customers in Minna a 5% balance top-up
UPDATE CUSTOMER
SET Balance = Balance * 1.05
WHERE AccountType = 'Savings' AND LGA = 'Chanchaga';
5.3.3 DELETE
-- Delete inactive customers who have zero balance
DELETE FROM CUSTOMER
WHERE Balance = 0.00 AND IsActive = FALSE;