We will now input these specifications into the MySQL environment using the phpMyAdmin graphical interface. Follow these short steps:
Step 1: Log in to phpMyAdmin using your MySQL username and password.
Step 2: Click the "database" link, and in the "Create new database" section enter customercomplaint.
Step 3: On the "Create new table on database customercomplaint," section, enter "customertable" and in the number of fields, enter 6. Click "go."
Use the design specifications to configure the variables in the database. See the screen shot below for a complete guide:
Do not forget to check "Current_Timestamp" under the Default column in receivingdate field. "Unsigned" means it will accept only positive values, which can be set under "Attributes". "Zero Fill" means it will insert zeroes for spaces if the number of digits entered is less than five.
For example, if the product serial key is 456, MySQL will store it as "00456."
The detailed MySQL query for creating the designed table is as follows:
`customername` VARCHAR( 64 ) NOT NULL ,`price` DECIMAL( 7, 3 ) UNSIGNED NOT NULL ,`datepurchased` DATE NOT NULL ,`productkey` SMALLINT( 5 ) UNSIGNED ZEROFILL NOT NULL ,`complaintdetails` TEXT NOT NULL ,`receivingdate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE = MYISAM
After everything is set, click "Save." You can now start inserting data into your newly-designed database. You will notice it will only accept data according to your specifications and display errors for those are not within the design.