Create New table Under a Database:
After pressing Create button a new
database has created for mysite website. Now we have to create table. As we
want to login so we have to create profile table for user consist with user
password and other information.
Open your favorite editor. In this
case I have opened Notepad++ and create a table. The table code is
appeared below.
CREATE TABLE IF NOT EXISTS `profile`
(
`profile_id` int(11) NOT NULL
AUTO_INCREMENT,
`first_name` varchar(50)
COLLATE utf8_unicode_ci DEFAULT NULL,
`last_name` varchar(50)
COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`password`
varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`update_date` timestamp NULL
DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY
(`profile_id`)
) ENGINE=InnoDB DEFAULT
CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
Where the table name is profile.
After written this code saves this file and save with the sql extension like
profile.sql.
Now Import this file to your created
database. After import you will see there exists a new table named profile.
Insert data to the ‘profile’ table:
Now go to the insert tab in insert
the data and press go.

No comments:
Post a Comment