0% found this document useful (0 votes)
17 views2 pages

CSDL Sangoiet

fgdg

Uploaded by

namcute0910
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

CSDL Sangoiet

fgdg

Uploaded by

namcute0910
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

CSDL sangoviet

table :
Category, category_id,name
products :product_id, name, price, description , warranty, origin,woodType, size,
material, Category_id, brand_id
brand : brand_id, name
customer :customer_id, name, email, phone
order: order_id, order_date, status, customer_id

CREATE TABLE category (


category_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL
);

CREATE TABLE brand (


brand_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL
);

CREATE TABLE wood_types (


wood_type_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT
);

CREATE TABLE products (


product_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
price DECIMAL(10, 2) NOT NULL,
description TEXT,
warranty VARCHAR(50),
origin VARCHAR(255),
size VARCHAR(100),
material VARCHAR(255),
category_id INT NOT NULL,
brand_id INT NOT NULL,
wood_type_id INT,
FOREIGN KEY (category_id) REFERENCES category(category_id) ON DELETE CASCADE,
FOREIGN KEY (brand_id) REFERENCES brand(brand_id) ON DELETE CASCADE,
FOREIGN KEY (wood_type_id) REFERENCES wood_types(wood_type_id) ON DELETE SET
NULL
);

CREATE TABLE news (


news_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
published_date DATE NOT NULL
);

CREATE TABLE customer (


customer_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255),
phone VARCHAR(20)
);
CREATE TABLE `order` (
order_id INT AUTO_INCREMENT PRIMARY KEY,
order_date DATE NOT NULL,
status ENUM('Pending', 'Processing', 'Completed', 'Cancelled') NOT NULL,
customer_id INT NOT NULL,
FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ON DELETE CASCADE
);

You might also like