Tailor Management System Database Design

Tailor Management System Database Design

The capstone project entitled “Tailor Management System” is a platform that allows the tailor to post and publish their products and designs. The system will serve as bridge between the tailor and the customer. Dedicated users are also part of the system in order to ensure the smooth flow of transactions between the tailor and the customer.

This article will provide you with the list of tables and field/columns for every table in the design of database structure/schema of tailor management system. The team will later provide a video tutorial on how to create the database in PHPMyAdmin.

Tailor Management System Database Design - List of Tables
Tailor Management System Database Design – List of Tables

This database design has 10 tables with their respective fields and columns as well as their relationships among each other.

tbl_product_category – this table will store the list of product category of the tailor management system. The following are the entities/columns of the table:

  • product_category_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • category_name – category name of the product (shirt, uniform, pants, etc.)
  • user_id – the user who encode/manage/update the product category information.

Create SQL Statement – the statement below is used to create the tbl_product_category, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_product_category` (
`product_category_id` int(11) NOT NULL,
`category_name` varchar(30) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

tbl_product – this table will store the products posted by different tailors, this is where the tailor can showcase their products and designs. The table has 12 columns and they are the following:

  • product_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • product_code – the unique code of the product, it is in a form of barcode, qrcode, or an alphanumeric combination.
  • product_name – the name of the product
  • product_detail – detailed description of the product.
  • product_category_id – this refers to the type or category of the product, it is a foreign key that links to the product category table.
  • quantity_on_hand – the number of available products.
  • tailor_price – cost of the product from the tailor.
  • retail_price – the price that will be sold to the customer. (the difference from the retail to tailor price will serve as the profit or share of the platform)
  • discount – discount of the product (if any).
  • tailor_id – the tailor who posted the product. It is a foreign key that points out to the tailor table.
  • status – availability status of the product.
  • user_id – the user who encode/manage/update/approve the product information.

Create SQL Statement – the statement below is used to create the tbl_product, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_product` (
`product_id` int(11) NOT NULL,
`product_code` varchar(30) NOT NULL,
`product_name` varchar(30) NOT NULL,
`product_detail` varchar(100) NOT NULL,
`product_category_id` int(11) NOT NULL,
`quantity_on_hand` int(4) NOT NULL,
`tailor_price` float NOT NULL,
`retail_price` float NOT NULL,
`discount` float NOT NULL,
`tailor_id` int(11) NOT NULL,
`status` int(1) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

tbl_order – this table stores the order information of the customer. The transaction will be manage by the users.

  • order_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • reference_no – control or monitoring number of the order transaction.
  • customer_id – refers to the customer who transacted the order. It is a foreign key that links to the customer table.
  • order_date – the date when the order was placed.
  • expected_delivery_date – the date the order will be delivered to the customer.
  • total_amount – total amount of the ordered products.
  • number_of_items – total number of items being ordered.
  • user_id – the user who encode/manage/update/approve the order information.

Create SQL Statement – the statement below is used to create the tbl_order, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_order` (
`order_id` int(11) NOT NULL,
`reference_no` varchar(30) NOT NULL,
`customer_id` int(11) NOT NULL,
`order_date` date NOT NULL,
`expected_delivery_date` date NOT NULL,
`total_amount` float NOT NULL,
`number_of_items` int(11) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

tbl_order_detail – this table will hold and store the itemized order by the customer.

  • order_detail_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • order_id – foreign key that links to the order table.
  • product_id – the list of items ordered by the customer, it is a foreign key that points out to the item or product table.
  • quantity – the number of items ordered by the customer (per product)
  • quantity_price – the price of the item. This was recorded since the price of the product in the product table might change or updated by the tailor.
  • status – this column will store 0 for completed, 1 for delivery, 2 for cancelled.
  • remarks – additional information or message on the item or product.
  • tailor_id – the tailor will be the one who can manage and update the status per item.

Create SQL Statement – the statement below is used to create the tbl_order_detail, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_order_detail` (
`order_detail_id` int(11) NOT NULL,
`order_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`quantity` int(4) NOT NULL,
`quantity_price` float NOT NULL,
`status` int(1) NOT NULL,
`remarks` varchar(100) NOT NULL,
`tailor_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

tbl_tailor – registration information of the tailor will saved and stored in this table. The table has the following columns:

  • tailor_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • tailor_name – complete name of the tailor.
  • tailor_address – complete address of the tailor (home or business address).
  • tailor_contact –contact information of the tailor (mobile or landline).
  • tailor_email – email address of the tailor (personal or business email).
  • tailor_profile_image – profile picture of the tailor.
  • profile_experience – list of experiences and accomplishments of the tailor.
  • tailor_username – desired username of the tailor.
  • tailoer_password – desired password of the tailor.
  • tailor_status – the value of this column is 0 or 1, 0 means deactivated or inactive, 1 is activated or active.
  • user_id – the user who accepts/approve/deactivate the tailor profile and registration. It is a foreign key that connects to the user table.

Create SQL Statement – the statement below is used to create the tbl_tailor, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_tailor` (
`tailor_id` int(11) NOT NULL,
`tailor_name` varchar(30) NOT NULL,
`tailor_address` varchar(100) NOT NULL,
`tailor_contact` varchar(15) NOT NULL,
`tailor_email` varchar(30) NOT NULL,
`tailor_profile_image` blob NOT NULL,
`profile_experience` varchar(200) NOT NULL,
`tailor_username` varchar(30) NOT NULL,
`tailor_password` varchar(30) NOT NULL,
`tailor_status` int(1) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

tbl_customer – this table will store the information of the customer, the table has 11 columns.

  • customer_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • customer_code – a unique code given to the person (qr code, barcode, etc)
  • avatar – this will hold the profile image of the person.
  • customer_name – full name of the client/customer.
  • email_address – email address of the client/customer.
  • contact_number – contact number of the client/customer, preferably mobile or cellphone number.
  • complete_address – complete address of the client/customer.
  • username – the desired username of the client/customer.
  • password – the desired password of the client/customer.
  • status – the value of this column is 0 or 1, 0 means deactivated or inactive, 1 is activated or active.
  • user_id – the user who accepts/approve/deactivate the customer profile and registration. It is a foreign key that connects to the user table.

Create SQL Statement – the statement below is used to create the tbl_customer, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_customer` (
`customer_id` int(11) NOT NULL,
`customer_code` varchar(30) NOT NULL,
`avatar` blob NOT NULL,
`customer_name` varchar(30) NOT NULL,
`email_address` varchar(30) NOT NULL,
`contact_number` varchar(15) NOT NULL,
`complete_address` varchar(100) NOT NULL,
`username` varchar(30) NOT NULL,
`password` varchar(30) NOT NULL,
`status` int(1) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

tbl_payment – payment information will be stored and archived on this table.

  • payment_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • order_id – points out to the appointment record.
  • amount_paid – amount paid by the customer.
  • remarks – additional information on the transaction.
  • payment_status – status of the payment (partial, fully paid)
  • paid_by – person who processed the payment (it is usually the customer information).
  • user_id – the user who processed the payment information.

Create SQL Statement – the statement below is used to create the tbl_payment, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_payment` (
`payment_id` int(11) NOT NULL,
`order_id` int(11) NOT NULL,
`amount_paid` float NOT NULL,
`remarks` varchar(100) NOT NULL,
`payment_status` int(1) NOT NULL,
`paid_by` varchar(30) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

tbl_setting– this table will store the information of the laundry shop or company. The table has 7 columns.

  • company_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • company_name – the complete name of the company.
  • company_contact_person – contact person of the company
  • company_email – official email address of the company
  • company_contact_number – contact information of the company (landline, mobile, etc)
  • company_website – official website of the company (if any)
  • company_profile – this column is open for any content such as the history of the company, services offered, and any other information about the company or shop
  • user_id – the user who accepts/approve/deactivate the company profile. It is a foreign key that connects to the user table.

Create SQL Statement – the statement below is used to create the tbl_setting, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_setting` (
`company_id` int(11) NOT NULL,
`company_name` varchar(50) NOT NULL,
`company_contact_person` varchar(30) NOT NULL,
`company_email` varchar(30) NOT NULL,
`company_contact_number` varchar(15) NOT NULL,
`company_website` varchar(30) NOT NULL,
`company_profile` varchar(250) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

tbl_user – this table will store the information of personnel who can access the records of the system.

  • user_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • username – username of the personnel used to login together with the password.
  • password – password of the personnel used to login together with the username.
  • avatar – this will hold the profile image of the user.
  • fullname – the complete name of the personnel or user.
  • contact – contact number of the personnel (mobile/cellphone number).
  • email – email address of the personnel/user.
  • user_category_id – the user group or category of the user.
  • status – the value of this column is 0 or 1, 0 means deactivated or inactive, 1 is activated or active.

Create SQL Statement – the statement below is used to create the tbl_user, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_user` (
`user_id` int(11) NOT NULL,
`username` varchar(30) NOT NULL,
`password` varchar(30) NOT NULL,
`avatar` blob NOT NULL,
`fullname` varchar(50) NOT NULL,
`contact` varchar(15) NOT NULL,
`email` varchar(30) NOT NULL,
`user_category_id` int(1) NOT NULL,
`status` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

tbl_user_group – this table store the information of the user group which includes the functions they can and can’t access in the system.

  • user_group_id – primary key of the table. It is set usually to auto_increment (the database will automatically give this column a value starting from 1).
  • group_name – name of the category or user group.
  • description – information on what the user group is all about.
  • allow_add – this column is to allow or prevent user from adding a record.
  • allow_edit – this column is to allow or prevent user from editing or updating a record.
  • allow_delete – this column is to allow or prevent user from removing or deleting a record.
  • allow_print – this column is to allow or prevent user from printing a report.
  • allow_import – this column is to allow or prevent user from importing records to the system.
  • allow_export – this column is to allow or prevent user from exporting records from the system.

Create SQL Statement – the statement below is used to create the tbl_user_group, copy the sql statement and paste it in the sql manager/tab of your phpmyadmin.

CREATE TABLE `tbl_user_group` (
`user_group_id` int(11) NOT NULL,
`group_name` varchar(30) NOT NULL,
`description` varchar(50) NOT NULL,
`allow_add` int(1) NOT NULL,
`allow_edit` int(1) NOT NULL,
`allow_delete` int(1) NOT NULL,
`allow_print` int(1) NOT NULL,
`allow_import` int(1) NOT NULL,
`allow_export` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Indexes for dumped tables

--
-- Indexes for table `tbl_customer`
--
ALTER TABLE `tbl_customer`
ADD PRIMARY KEY (`customer_id`),
ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tbl_order`
--
ALTER TABLE `tbl_order`
ADD PRIMARY KEY (`order_id`),
ADD KEY `customer_id` (`customer_id`),
ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tbl_order_detail`
--
ALTER TABLE `tbl_order_detail`
ADD PRIMARY KEY (`order_detail_id`),
ADD KEY `order_id` (`order_id`),
ADD KEY `product_id` (`product_id`),
ADD KEY `tailor_id` (`tailor_id`);

--
-- Indexes for table `tbl_payment`
--
ALTER TABLE `tbl_payment`
ADD PRIMARY KEY (`payment_id`),
ADD KEY `user_id` (`user_id`),
ADD KEY `order_id` (`order_id`);

--
-- Indexes for table `tbl_product`
--
ALTER TABLE `tbl_product`
ADD PRIMARY KEY (`product_id`),
ADD KEY `product_category_id` (`product_category_id`),
ADD KEY `tailor_id` (`tailor_id`),
ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tbl_product_category`
--
ALTER TABLE `tbl_product_category`
ADD PRIMARY KEY (`product_category_id`),
ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tbl_setting`
--
ALTER TABLE `tbl_setting`
ADD PRIMARY KEY (`company_id`),
ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tbl_tailor`
--
ALTER TABLE `tbl_tailor`
ADD PRIMARY KEY (`tailor_id`),
ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tbl_user`
--
ALTER TABLE `tbl_user`
ADD PRIMARY KEY (`user_id`),
ADD KEY `user_category_id` (`user_category_id`);

--
-- Indexes for table `tbl_user_group`
--
ALTER TABLE `tbl_user_group`
ADD PRIMARY KEY (`user_group_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `tbl_customer`
--
ALTER TABLE `tbl_customer`
MODIFY `customer_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_order`
--
ALTER TABLE `tbl_order`
MODIFY `order_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_order_detail`
--
ALTER TABLE `tbl_order_detail`
MODIFY `order_detail_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_payment`
--
ALTER TABLE `tbl_payment`
MODIFY `payment_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_product`
--
ALTER TABLE `tbl_product`
MODIFY `product_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_setting`
--
ALTER TABLE `tbl_setting`
MODIFY `company_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_tailor`
--
ALTER TABLE `tbl_tailor`
MODIFY `tailor_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_user`
--
ALTER TABLE `tbl_user`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_user_group`
--
ALTER TABLE `tbl_user_group`
MODIFY `user_group_id` int(11) NOT NULL AUTO_INCREMENT;

Constraints for dumped tables

--
-- Constraints for table `tbl_customer`
--
ALTER TABLE `tbl_customer`
ADD CONSTRAINT `tbl_customer_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tbl_order`
--
ALTER TABLE `tbl_order`
ADD CONSTRAINT `tbl_order_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tbl_order_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `tbl_customer` (`customer_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tbl_order_detail`
--
ALTER TABLE `tbl_order_detail`
ADD CONSTRAINT `tbl_order_detail_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `tbl_order` (`order_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tbl_order_detail_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `tbl_product` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tbl_order_detail_ibfk_3` FOREIGN KEY (`tailor_id`) REFERENCES `tbl_tailor` (`tailor_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tbl_payment`
--
ALTER TABLE `tbl_payment`
ADD CONSTRAINT `tbl_payment_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tbl_payment_ibfk_2` FOREIGN KEY (`order_id`) REFERENCES `tbl_order` (`order_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tbl_product`
--
ALTER TABLE `tbl_product`
ADD CONSTRAINT `tbl_product_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tbl_product_ibfk_2` FOREIGN KEY (`tailor_id`) REFERENCES `tbl_tailor` (`tailor_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tbl_product_category`
--
ALTER TABLE `tbl_product_category`
ADD CONSTRAINT `tbl_product_category_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tbl_setting`
--
ALTER TABLE `tbl_setting`
ADD CONSTRAINT `tbl_setting_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tbl_tailor`
--
ALTER TABLE `tbl_tailor`
ADD CONSTRAINT `tbl_tailor_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tbl_user`
--
ALTER TABLE `tbl_user`
ADD CONSTRAINT `tbl_user_ibfk_1` FOREIGN KEY (`user_category_id`) REFERENCES `tbl_user_group` (`user_group_id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
Tailor Management System Database Design
Tailor Management System Database Design

Free Download .sql file

Our team can modify the project based on your specific business requirements.

You may visit our facebook page for more information, inquiries and comments.

Hire our team to do the project.

Comments

comments

, , ,

Post navigation