02-Creating Database and Setting Up tables

0
504

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

  1. CREATE TABLE IF NOT EXISTS <code>employees</code> (
  2. <code>ID</code> int(11) AUTO_INCREMENT NOT NULL,
  3. <code>EMPLOYEE_ID</code> int(11) NOT NULL,
  4. <code>FIRST_NAME</code> varchar(255) DEFAULT NULL,
  5. <code>LAST_NAME</code> varchar(255) DEFAULT NULL,
  6. <code>MIDDLE_NAME</code> varchar(255) DEFAULT NULL,
  7. <code>ADDRESS</code> varchar(255) DEFAULT NULL,
  8. <code>PHONE_NUMBER</code> varchar(255) DEFAULT NULL,
  9. <code>STATUS</code> varchar(255) DEFAULT NULL,
  10. <code>BIRTH_DATE</code> datetime DEFAULT NULL,
  11. <code>BIRTH_PLACE</code> varchar(255) DEFAULT NULL,
  12. <code>GENDER</code> varchar(255) DEFAULT NULL,
  13. <code>AGE</code> int(11) DEFAULT NULL,
  14. <code>EMERG_CONTACT</code> varchar(255) DEFAULT NULL,
  15. PRIMARY KEY (<code>ID</code>),
  16. KEY (<code>EMPLOYEE_ID</code>)
  17. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

For the employees work information table

  1. CREATE TABLE IF NOT EXISTS <code>employeesworkinfo</code> (
  2. <code>ID</code> int(11) AUTO_INCREMENT DEFAULT NULL,
  3. <code>EMPLOYEE_ID</code> varchar(255) NOT NULL,
  4. <code>D_RATE</code> varchar(255) DEFAULT NULL,
  5. <code>POSITION</code> varchar(90) DEFAULT NULL,
  6. <code>P_METHOD</code> varchar(255) DEFAULT NULL,
  7. <code>W_STATUS</code> varchar(255) DEFAULT NULL,
  8. <code>D_HIRED</code> datetime DEFAULT NULL,
  9. PRIMARY KEY (<code>ID</code>),
  10. KEY (<code>EMPLOYEE_ID</code>)
  11. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

For the users table

  1. CREATE TABLE IF NOT EXISTS <code>USERACCOUNTS</code> (
  2. <code>ID</code> int(11) AUTO_INCREMENT DEFAULT NULL,
  3. <code>USER_ID</code> varchar(255) NOT NULL,
  4. <code>UNAME</code> varchar(255) DEFAULT NULL,
  5. <code>USERNAME</code> varchar(255) DEFAULT NULL,
  6. <code>PASS</code> varchar(255) DEFAULT NULL,
  7. <code>TYPE</code> varchar(30) DEFAULT NULL,
  8. PRIMARY KEY (<code>ID</code>),
  9. KEY (<code>USER_ID</code>)
  10. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here