Skip to content

Instantly share code, notes, and snippets.

@RusimbiPatrick
Last active July 23, 2023 05:00
Show Gist options
  • Select an option

  • Save RusimbiPatrick/2e81bca46f4452a68af1c44c0331f441 to your computer and use it in GitHub Desktop.

Select an option

Save RusimbiPatrick/2e81bca46f4452a68af1c44c0331f441 to your computer and use it in GitHub Desktop.
Assignment Dummy Data
DROP DATABASE assignment;
CREATE DATABASE assignment;
USE assignment;
CREATE TABLE Customers (
CustomerID INT AUTO_INCREMENT PRIMARY KEY,
CustomerName VARCHAR(100),
Email VARCHAR(100)
);
CREATE TABLE Customers (
CustomerID INT AUTO_INCREMENT PRIMARY KEY,
CustomerName VARCHAR(100),
Email VARCHAR(100)
);
INSERT INTO Customers (CustomerName, Email)
VALUES
('John Doe', 'john@example.com'),
('Alice Smith', 'alice@example.com'),
('Bob Johnson', 'bob@example.com'),
('Mary Brown', 'mary@example.com');
CREATE TABLE Orders (
OrderID INT AUTO_INCREMENT PRIMARY KEY,
CustomerID INT,
OrderDate DATE,
TotalAmount DECIMAL(10, 2),
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
);
INSERT INTO Orders (CustomerID, OrderDate, TotalAmount)
VALUES
(1, '2023-07-20', 150.00),
(2, '2023-07-21', 200.50),
(3, '2023-07-21', 50.75),
(1, '2023-07-22', 75.20),
(4, '2023-07-22', 120.00);
CREATE TABLE Posts (
PostID INT AUTO_INCREMENT PRIMARY KEY,
Title VARCHAR(200),
Content TEXT
);
INSERT INTO Posts (Title, Content)
VALUES
('Introduction to MySQL Joins', 'In this post, we will explore the different types of MySQL joins...'),
('Getting Started with Python', 'Python is a popular programming language known for its simplicity...'),
('Web Development with HTML and CSS', 'Learn how to build responsive and beautiful websites...'),
('Data Analysis with Pandas', 'Pandas is a powerful library for data manipulation and analysis...');
CREATE TABLE Comments (
CommentID INT AUTO_INCREMENT PRIMARY KEY,
PostID INT,
CommentText TEXT,
FOREIGN KEY (PostID) REFERENCES Posts(PostID)
);
INSERT INTO Comments (PostID, CommentText)
VALUES
(1, 'Great article!'),
(1, 'I found the examples very helpful.'),
(2, 'Python is my favorite language!'),
(3, 'Thanks for the tips!'),
(1, 'Could you explain JOINs in more detail?');
CREATE TABLE Suppliers (
SupplierID INT AUTO_INCREMENT PRIMARY KEY,
SupplierName VARCHAR(100),
Address VARCHAR(200),
Phone VARCHAR(20)
);
INSERT INTO Suppliers (SupplierName, Address, Phone)
VALUES
('Supplier A', '123 Main Street, City A', '555-123-4567'),
('Supplier B', '456 Elm Street, City B', '555-987-6543'),
('Supplier C', '789 Oak Street, City C', '555-222-3333');
CREATE TABLE Products (
ProductID INT AUTO_INCREMENT PRIMARY KEY,
ProductName VARCHAR(200),
SupplierID INT,
Price DECIMAL(10, 2),
FOREIGN KEY (SupplierID) REFERENCES Suppliers(SupplierID)
);
INSERT INTO Products (ProductName, SupplierID, Price)
VALUES
('Product 1', 1, 50.00),
('Product 2', 1, 75.00),
('Product 3', 2, 30.50),
('Product 4', 2, 100.00),
('Product 5', 3, 45.75);
CREATE TABLE Users (
UserID INT AUTO_INCREMENT PRIMARY KEY,
UserName VARCHAR(100),
Age INT,
Country VARCHAR(100)
);
INSERT INTO Users (UserName, Age, Country)
VALUES
('User1', 25, 'USA'),
('User2', 30, 'Canada'),
('User3', 22, 'UK'),
('User4', 28, 'Australia');
CREATE TABLE Employees (
EmployeeID INT AUTO_INCREMENT PRIMARY KEY,
EmployeeName VARCHAR(100),
DepartmentID INT,
Salary DECIMAL(10, 2),
HireDate DATE,
ManagerID INT,
FOREIGN KEY (ManagerID) REFERENCES Employees(EmployeeID)
);
INSERT INTO Employees (EmployeeName, DepartmentID, Salary, HireDate, ManagerID)
VALUES
('John Smith', 1, 55000.00, '2021-01-15', NULL),
('Alice Johnson', 2, 60000.00, '2020-03-22', 1),
('Bob Williams', 2, 58000.00, '2021-07-10', 1),
('Mary Davis', 3, 52000.00, '2019-11-02', 2),
('Michael Lee', 3, 54000.00, '2020-08-05', 2);
CREATE TABLE Questions (
QuestionID INT AUTO_INCREMENT PRIMARY KEY,
QuestionText TEXT,
Difficulty INT,
CreatedDate DATE
);
INSERT INTO Questions (QuestionText, Difficulty, CreatedDate)
VALUES
('What is the capital of France?', 2, '2022-05-10'),
('What is the formula for calculating the area of a circle?', 3, '2021-12-18'),
('What is the main function of the heart?', 1, '2023-01-05'),
('Which programming language is known for its use in web development?', 2, '2020-09-30'),
('Who wrote the play "Romeo and Juliet"?', 2, '2022-08-20');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment