Page 508 - Computer_Science_F5
P. 508
(a) SQL script file: A file Activity 8.25:
containing the SQL
statements used to create the Altering the structure of an SQL
database, tables, index, and database
view. Aim: Chapter Eight: Databases and Database Management Systems
FOR ONLINE READING ONLY
(b) Database schema diagram: Learn how to modify the structure of an
A diagram showing the existing database table by adding new
relationships between the columns.
“farmers” and “crops” tables. Materials:
Computers with Internet access; MySQL
(c) Execution report: A document client or command-line interface (such
detailing the steps taken to as MySQL Workbench, phpMyAdmin)
execute the SQL statements, or access to an online SQL editor (e.g.,
including screenshots of W3Schools)
the process and any output Instructions
generated.
Step 1: Open your SQL client or online
(d) View query results: A report SQL editor.
or screenshot displaying the Step 2: Use the following SQL command
results of querying the “crop_ to add a new column to the
farmer_information” view. “farmers” table:
(e) Reflection: A brief summary ALTER TABLE farmers ADD COLUMN email
reflecting on the experience, VARCHAR(50);
challenges faced, and what Step 3: Verify the changes by querying
was learned from the activity. the structure of the “farmers”
table, codes look as:
Finally, document your work in
a portifolio. DESCRIBE farmers;
Deliverables
ALTER: Modify the structure of Write a brief report which includes the
an existing database object. following:
In the context of the farming (a) SQL script that alters the “farmers” table
database let us modify the structure by adding a new column.
of the “farmers” table by adding (b) Screenshot or output showing the
a new column called “email” to updated structure of the “farmers” table
store the email addresses of the with the new “email” column.
farmers. To accomplish this, we Finally, document all your work in a
use the ALTER TABLE statement portifolio.
to modify the existing table.
499
Student’s Book Form Five
Computer Science Form 5.indd 499 23/07/2024 12:35

