Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find out the database in the code #1

Open
KPR111 opened this issue Oct 17, 2022 · 2 comments
Open

Unable to find out the database in the code #1

KPR111 opened this issue Oct 17, 2022 · 2 comments

Comments

@KPR111
Copy link

KPR111 commented Oct 17, 2022

any one please create the all tables for the database and upload in the project

@atanu20
Copy link
Owner

atanu20 commented Oct 17, 2022 via email

@VijayJr02
Copy link

create database ecom_react;
use ecom_react;
CREATE TABLE products (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
price DECIMAL(10, 2) NOT NULL,
image_url VARCHAR(255), -- If you have images for products
stock INT DEFAULT 0
);

CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL
);

CREATE TABLE user_data (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
email VARCHAR(255),
phone VARCHAR(20),
address TEXT,
user_id INT,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);

CREATE TABLE orders (
id INT AUTO_INCREMENT PRIMARY KEY,
userid INT,
totalprice DECIMAL(10, 2),
orderstatus VARCHAR(50),
paymentmode VARCHAR(50),
paymentid VARCHAR(255),
FOREIGN KEY (userid) REFERENCES users(id) ON DELETE CASCADE
);

CREATE TABLE orderitems (
id INT AUTO_INCREMENT PRIMARY KEY,
orderid INT,
productid INT,
productqty INT,
productprice DECIMAL(10, 2),
FOREIGN KEY (orderid) REFERENCES orders(id) ON DELETE CASCADE,
FOREIGN KEY (productid) REFERENCES products(id) ON DELETE CASCADE
);

INSERT INTO products (id, name, description, price, stock, image_url) VALUES
(1, 'Snake Plant', 'Also known as "Mother-in-law's Tongue," this plant has tall, upright leaves with green bands. It's popular for its air-purifying qualities and easy maintenance, thriving in low light and requiring minimal watering.', 400.00, 10, 'img/snake_plant.png'),
(2, 'Nerve Plant', 'This plant has small, dark green leaves with prominent white or pink veins. It prefers indirect light and requires regular watering, as it enjoys a humid environment.', 200.00, 10, 'img/nerve_plant.png'),
(3, 'Spider Plant', 'This plant has long, arching leaves with green and white stripes. Known for its air-purifying properties, it grows quickly and can tolerate various light conditions, though it prefers indirect light.', 300.00, 10, 'img/spider_plant.png'),
(4, 'Rubber Plant', 'This plant features large, glossy, dark green leaves. It thrives in bright, indirect light and needs occasional watering, making it a popular indoor plant choice for improving air quality.', 450.00, 10, 'img/rubber_plant.png'),
(5, 'Golden Pothos / Money Plant', 'Known as the Money Plant, this plant has heart-shaped, green leaves with yellow variegation. It's resilient and grows well in low light, making it a great beginner-friendly indoor plant.', 350.00, 10, 'img/golden_pothos.png'),
(6, 'Jade Plant', 'The Jade Plant has thick, fleshy, oval-shaped leaves. It's a succulent that stores water in its leaves, requiring minimal watering and doing well in bright, indirect light.', 500.00, 10, 'img/jade_plant.png'),
(7, 'Anthurium', 'This plant has glossy green leaves and vibrant red or pink spathes (flower-like structures). It does best in bright, indirect light and prefers a humid environment.', 600.00, 10, 'img/anthurium.png'),
(8, 'Golden Money Plant', 'This variety of the Money Plant has bright, lime-green leaves. Like other pothos varieties, it’s easy to care for and can thrive in low to moderate light.', 300.00, 10, 'img/golden_money_plant.png'),
(9, 'Dracaena', 'This plant has long, green, lance-shaped leaves. Dracaena varieties are popular indoor plants that can tolerate low light and require moderate watering.', 550.00, 10, 'img/dracaena.png');

SELECT * FROM products;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants