02-Creating Database and Setting Up tables

0
519

This tutorial is all about Creating Database and Setting Up tables.
Now, I’m going to start this tutorial on how to create a database and set up the tables that are needed. You have to install XAMMP in your computer. After that, open the browser and type the “localhos/phpmyadmin/” in the navigation panel and press enter on the keyboard in your computer to redirect into the MySQL Localhost. Create a database and name it “dbinformation”. Then, do this query for creating all the tables.

 

 

For the employees table
[mysql] CREATE TABLE IF NOT EXISTS employees (
ID int(11) AUTO_INCREMENT NOT NULL,
EMPLOYEE_ID int(11) NOT NULL,
FIRST_NAME varchar(255) DEFAULT NULL,
LAST_NAME varchar(255) DEFAULT NULL,
MIDDLE_NAME varchar(255) DEFAULT NULL,
ADDRESS varchar(255) DEFAULT NULL,
PHONE_NUMBER varchar(255) DEFAULT NULL,
STATUS varchar(255) DEFAULT NULL,
BIRTH_DATE datetime DEFAULT NULL,
BIRTH_PLACE varchar(255) DEFAULT NULL,
GENDER varchar(255) DEFAULT NULL,
AGE int(11) DEFAULT NULL,
EMERG_CONTACT varchar(255) DEFAULT NULL,
PRIMARY KEY (ID),
KEY (EMPLOYEE_ID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[/mysql] For the employees work information table
[mysql] CREATE TABLE IF NOT EXISTS employeesworkinfo (
ID int(11) AUTO_INCREMENT DEFAULT NULL,
EMPLOYEE_ID varchar(255) NOT NULL,
D_RATE varchar(255) DEFAULT NULL,
POSITION varchar(90) DEFAULT NULL,
P_METHOD varchar(255) DEFAULT NULL,
W_STATUS varchar(255) DEFAULT NULL,
D_HIRED datetime DEFAULT NULL,
PRIMARY KEY (ID),
KEY (EMPLOYEE_ID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[/mysql] For the users table
[mysql] CREATE TABLE IF NOT EXISTS USERACCOUNTS (
ID int(11) AUTO_INCREMENT DEFAULT NULL,
USER_ID varchar(255) NOT NULL,
UNAME varchar(255) DEFAULT NULL,
USERNAME varchar(255) DEFAULT NULL,
PASS varchar(255) DEFAULT NULL,
TYPE varchar(30) DEFAULT NULL,
PRIMARY KEY (ID),
KEY (USER_ID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[/mysql]

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.