Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By : Sai S Sriparasa
Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By: Sai S Sriparasa

Overview of this book

Table of Contents (17 chapters)
Building a Web Application with PHP and MariaDB: A Reference Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Enhancing the existing tables


Let's begin by making a few changes to the existing students table. We will be adding two columns to the students table that would store a student's username and password. This database will be used to support Student Portal that we will build at a later point. The information available in the username and password fields will be used to authenticate and authorize the student to login to the student portal. There are a couple of ways to facilitate these changes; the first method is to use the DROP TABLE DDL command to remove the existing students table and use the CREATE TABLE DDL command to create a new students table that would have the extra username and password fields. This method however causes loss of existing data. The second method is to use the ALTER TABLE DDL command to add new columns to the existing students table.

The following screenshot shows the usage of these commands for altering the students table:

In this example, we have coupled the ALTER...