Page 84 - Computer Software Application TP - Volume 1
P. 84
COMPUTER SOFTWARE APPLICATION - CITS
EXERCISE 22 : Applying Data Integrity Rules
Objectives
At the end of this exercise you shall be able to
• start MySQL server ans access MySQL
• desine conctraints
• check and verify integrity rules.
Requirements
Tools/Materials
• Desktop/Laptop with latest configuration
• Operating system: window 10:11
• XAMPP server r3.3.0
Procedure
TASK 1 : Applying data intergrity rules
1 Start MySQL Server: start the MySQL server. You can do this by going to the Services application in Windows,
finding MySQL service, and starting it.
2 Access MySQL: Open the MySQL command line client or a GUI tool like MySQL Workbench to access your
MySQL server.
3 Define Your Rules
Start by understanding the data relationships and desired constraints. Consider:
Primary Keys: Identify unique identifiers for each table (e.g., product id in a products table).
Foreign Keys: Create references between related tables (e.g., order id in an orders table referencing product id
in the products table).
Data Types: Specify allowed data types for each column (e.g., INT for numbers, VARCHAR for text).
NOT NULL: Mark columns that cannot be empty.
UNIQUE: Ensure specific values appear only once within a column.
69
CITS : IT & ITES - Computer Software Application - Exercise 21