Home > Courses > Web development using PHP and MySQL > Create table with phpMyAdmin

Create table with phpMyAdmin

Subject: Web development using PHP and MySQL
As we continue from the last topic, we will create the table "Feedback" in the "BGdb" database.

Enter “Feedback” in the field below "Create new table on the database BGdb” and enter "5" for the Number of fields and click the "Go" button. See the screenshot (Creating table)

Immediately this is done, you will see several form fields that will allow you to setup the five (5) fields and their respective properties. (Tables fields and properties )

Start with the first field ID

Properties for the "id" field
Field (id): this is the name of the field
Type (INT): this will ensure that only whole number is permitted in this field
Length/Values (10): this set the number digit for this “id” field, 6 would be a million, therefore 10 is very large set of digits, isn’t it?
Index (Primary): this makes this “id” field to be the primary key i.e unique field.

A_I(Auto_Increment): this should be selected or checked. This will enable auto generated number to be entered in the this field (in ascending order 1, 2, 3…) when ever a record is entered in this table

Properties for other fields
Similarly complete the form for other fields (name, email, comment and date_submit)
as we have in the screenshot

Notice that I only set the following properties (Field, Type and Length/Values) for the other fields and click the save button to create the Feedback table as can be seen in the screenshot (Feedback table created)

If you prefer to do this using an SQL statement, click the SQL tab (see screenshot - SQL tab) and enter the SQL code below, in the box before clicking the "Go" button.


CREATE TABLE Feedback (
id INT(10) NOT NULL AUTO_INCREMENT ,
name VARCHAR(255) NULL ,
email VARCHAR(255) NULL ,
comment TEXT NULL ,
date_submit DATETIME NULL ,
PRIMARY KEY (id)
);


Try and create more tables using both methods just for practice, you can always delete this "practice" tables. The technical term for this is "drop". In the next topic we will learn how to drop/delete a table.

Creating table




Tables fields and properties




Feedback table created




SQL tab





By: Benjamin Onuorah

Comments

No Comment yet!

Login to comment or ask question on this topic


Previous Topic Next Topic

Supported by