You are on page 1of 2

1.

Mô hình quan hệ
ProductTypes(type_id, type_name)

ProductImages(image_id, product_id, image_url)

Products(product_id,product_type, category_id, product_name, old_price, new_price,


main_image_url, description, meterial, origin, pattern, is_active, is_delete)

Options(option_id, product_id, color_id, size_id, available_quantity)

Colors(color_id, color_name)

Sizes(size_id, size_name)

Categories(category_id, category _name)

Bills(bill_id, user_id, status_order, date, total_price)

Bill_Detail(bill_id, option_id, ordered_quantity)

StatusOrders(status_id, status_name)

Users(user_id, role_id, email, password, fullname, address, phonenumber, is_active_acc,


is_delete_acc)

Roles(role_id, role_name)

Bills(bill_id, user_id, date, total_price, status_order)


Orders(order_id, bill_id, prduct_id, size_id, color_id, quantity)

2. Các ràng buộc toàn vẹn


Quan hệ Ràng buộc toàn vẹn
ProductTypes - Khóa chính: type_id
(Áo, quần)
ProductImages - Khóa chính: image_id
(Hình preview)
Products - Khóa chính: product_id
- Khóa ngoại: product_type, category_id
- Khi tạo sản phẩm thì các thuộc tính khóa ngoại đều không được
NULL.
- Các trường thuộc tính có thể NULL: description, meterial, origin,
pattern.
Options
Colors
Sizes
Categories
Bills
Bill_Detail
StatusOrders
Users
Roles

You might also like