0% found this document useful (0 votes)
22 views3 pages

Tables For Assignment 2

The document provides SQL queries to create and populate three tables: Customers, Products, and Sales. Each table includes a schema definition with relevant fields and data types, followed by multiple insert statements to add sample data. The Sales table also establishes foreign key relationships with the Customers and Products tables.

Uploaded by

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

Tables For Assignment 2

The document provides SQL queries to create and populate three tables: Customers, Products, and Sales. Each table includes a schema definition with relevant fields and data types, followed by multiple insert statements to add sample data. The Sales table also establishes foreign key relationships with the Customers and Products tables.

Uploaded by

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

Use these SQL queries to create and insert values into the tables

required for Assignment 2

Customers:
CREATE TABLE Customers (
Customer_ID INT PRIMARY KEY,
Customer_Name VARCHAR(255),
Email VARCHAR(255),
Location VARCHAR(255),
Phone_Number VARCHAR(20)
);

INSERT INTO Customers (Customer_ID, Customer_Name, Email, Location,


Phone_Number)
VALUES
(1001, 'Aarav Patel', '[email protected]', 'Mumbai', '9876543210'),
(1002, 'Saanvi Sharma', '[email protected]', 'Delhi', '9887766554'),
(1003, 'Vihaan Kumar', '[email protected]', 'Bangalore', '9765432109'),
(1004, 'Isha Reddy', '[email protected]', 'Hyderabad', '9843215678'),
(1005, 'Advait Singh', '[email protected]', 'Chennai', '9556677889'),
(1006, 'Ananya Joshi', '[email protected]', ‘Delhi', '9675321098'),
(1007, 'Reyansh Verma', '[email protected]', 'Kolkata', '9998887777'),
(1008, 'Madhavi Nair', '[email protected]', 'Kerala', '9732146589'),
(1009, 'Kabir Gupta', '[email protected]', 'Delhi', '9812365478'),
(1010, 'Priya Mehta', '[email protected]', 'Mumbai', '9723456789');
Products:
CREATE TABLE Products (
Product_ID INT PRIMARY KEY,
Product_Name VARCHAR(100),
Category VARCHAR(50),
Price DECIMAL(10, 2),
Stock_Quantity INT
);
INSERT INTO Products (Product_ID, Product_Name, Category, Price, Stock_Quantity)
VALUES
(101, 'Smartphone', 'Electronics', 499.99, 150),
(102, 'Laptop', 'Electronics', 899.99, 100),
(103, 'Headphones', 'Accessories', 50.00, 300),
(104, 'Shirt', 'Apparel', 25.00, 500),
(105, 'Jeans', 'Apparel', 40.00, 200),
(106, 'Coffee Maker', 'Home Appliances', 75.00, 80),
(107, 'Blender', 'Home Appliances', 45.00, 60),
(108, 'Watch', 'Accessories', 120.00, 120),
(109, 'Running Shoes', 'Footwear', 60.00, 250),
(110, 'Backpack', 'Accessories', 30.00, 350);

Sales:
CREATE TABLE Sales (
Sale_ID INT PRIMARY KEY,
Sale_Date DATE,
Customer_ID INT,
Product_ID INT,
Quantity INT,
Total_Amount DECIMAL(10, 2),
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID),
FOREIGN KEY (Product_ID) REFERENCES Products(Product_ID)
);
INSERT INTO Sales (Sale_ID, Sale_Date, Customer_ID, Product_ID, Quantity)
VALUES
(1, '2025-03-01', 1003, 101, 1),
(2, '2025-03-02', 1008, 106, 2),
(3, '2025-03-02', 1001, 108, 3),
(4, '2025-03-03', 1007, 102, 1),
(5, '2025-03-04', 1004, 105, 4),
(6, '2025-03-05', 1002, 107, 1),
(7, '2025-03-06', 1009, 109, 2),
(8, '2025-03-07', 1010, 103, 1),
(9, '2025-03-08', 1006, 110, 1),
(10, '2025-03-09', 1005, 104, 3),
(11, '2025-03-10', 1003, 109, 5),
(12, '2025-03-11', 1001, 101, 2),
(13, '2025-03-12', 1008, 104, 1),
(14, '2025-03-13', 1002, 106, 3),
(15, '2025-03-14', 1004, 108, 2),
(16, '2025-03-15', 1009, 103, 1),
(17, '2025-03-16', 1006, 110, 4),
(18, '2025-03-17', 1007, 105, 2),
(19, '2025-03-18', 1005, 107, 1),
(20, '2025-03-19', 1010, 102, 1);

You might also like