-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQL_queries.sql
43 lines (38 loc) · 1001 Bytes
/
SQL_queries.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
CREATE DATABASE chs;
use chs;
CREATE TABLE User_details (
User_id INT AUTO_INCREMENT PRIMARY KEY,
First_Name VARCHAR(255),
Last_Name VARCHAR(255),
Age INT,
Sex VARCHAR(10),
Contact_Number VARCHAR(20),
Email_ID VARCHAR(255),
Password VARCHAR(255)
);
CREATE TABLE Store_user (
Store_user_id INT AUTO_INCREMENT PRIMARY KEY,
First_Name VARCHAR(255),
Last_Name VARCHAR(255),
Age INT,
Sex VARCHAR(10),
Contact_Number VARCHAR(20),
Email_ID VARCHAR(255),
Password VARCHAR(255),
Designation VARCHAR(20)
);
CREATE TABLE Products (
Product_id INT AUTO_INCREMENT PRIMARY KEY,
Product_name VARCHAR(255),
Rate DECIMAL(10, 2),
Stock INT
);
CREATE TABLE Purchase (
Purchase_id INT AUTO_INCREMENT PRIMARY KEY,
User_id INT,
Item VARCHAR(255),
Quantity INT,
Rate DECIMAL(10, 2),
Date_of_purchase DATE,
FOREIGN KEY (User_id) REFERENCES User_details(User_id)
);