Page 478 - Computer_Science_F5
P. 478
FOR ONLINE READING ONLY
Figure 8.19: Creating database and table Chapter Eight: Databases and Database Management Systems
When you run the code, it will create the database, and inside the database, the table
will also be created, as shown in Figure 8.20.
Figure 8.20: SQL query for creating a table
(b) ALTER
Alter command is a statement used to add, delete, or modify columns in an existing
table. The syntax to alter a table by adding a column is ALTER TABLE table_name
ADD column_name datatype; For example, if you want to add a parent name in our
database named “student” in the table student_ registration, the SQL command will
be: ALTER TABLE student_registration ADD ParentName varchar(255); This will
add the ParentName column to the student_registration table. To delete a column
469
Student’s Book Form Five
Computer Science Form 5.indd 469 23/07/2024 12:34

