Question

This is third time im posting this Question COURSE; introduction to database Please, No handwriting thanks...

This is third time im posting this Question
COURSE; introduction to database
Please, No handwriting
thanks for your efforts
Design the database by following
. Execute the sample requested queries.
. ER Diagram.
. All schemas before and after normalization.
. All SQL statements of:
-Creating tables.
- Inserting data in tables.
-Queries.
5. Screenshots from MySQL (or any other software you use)

Question is

- Database system for a Wholesale Management System

Consider a database system for a Wholesale Management System. The data requirements are summarized as follows:

o Maintain the details of stock like their id, name, quantity.

o Maintain the details of buyers from which manager has to buy the stock like buyer id, name, address, stock id to be bought.

o Details of customers i.e. name, address, id.

o Defaulters list of customers who have not paid their pending amount after the due date So List of payment paid or pending.

o The stock that is to buy if quantity goes less than a particular amount.

o Profit calculation for a month.

o Quantity cannot be sold to a customer if the required amount is not present in stock and date of delivery should be maintained up to which stock can be provided.

SQL Queries:

1. List of payment paid or pending customers.

2. Find the Defaulters list of customers who have not paid their pending amount.

3. Find the details of customers name, address, id.

4. Find Query to get information of employee where employee is not assigned to the department.

5. List the stock that is to buy if quantity goes less than a particular amount.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ER Diagram

Tables before normalization

Stock(Id, Name, Quantity)

Customer(Id, Name, Address)

Buyer(BuyerId, StockId, Name, Address, DueDate, PaymentStauts)

Tables after normalization

Since name and address of buyer is already in customer table, so it is not required in buyer table again.

Stock(Id, Name, Quantity)

Customer(Id, Name, Address)

Buyer(BuyerId, StockId, DueDate, PaymentStauts)

SQL Queries

-- stock table

CREATE TABLE stock

(
id       VARCHAR(10)   PRIMARY KEY,
name   VARCHAR(30),
quantity   NUMBER

)

-- customer table

CREATE TABLE customer
(
id       VARCHAR(10)   PRIMARY KEY,
name   VARCHAR(30),
address   VARCHAR(30)
)

--

CREATE TABLE buyer
(
buyerId   VARCHAR(10)   REFERENCES customer(id),
name   VARCHAR(30),
address   VARCHAR(30),
stockId   VARCHAR(10)   REFERENCES stock(id),
paymentStatus   VARCHAR(10),
dueDate   DATE,
PRIMARY KEY(buyerId,stockId)
)

-- insert data into tables


INSERT INTO customer VALUES('C01', 'John', 'Chicago');
INSERT INTO customer VALUES('C11', 'Smith', 'Chicago');
INSERT INTO customer VALUES('C6', 'Steve', 'Los Angeles');
INSERT INTO customer VALUES('C51', 'Smith and Jones', 'California');

INSERT INTO stock VALUES('E01', 'Charger', 50);
INSERT INTO stock VALUES('P02', 'iPhone X', 10);
INSERT INTO stock VALUES('E07', 'USB cables-C type', 15);

INSERT INTO buyer VALUES('C01', 'John', 'Chicago', 'P02', 'Due', '15-APR-2019');
INSERT INTO buyer VALUES('C6', 'Steve', 'Los Angeles', 'E01', 'Paid', '15-MAR-2019');

SQL Queries

--list of paid buyers

SELECT * FROM buyer WHERE paymentStatus LIKE 'Paid';

-- list of pending payment of buyers

SELECT * FROM buyer WHERE paymentStatus LIKE 'Due';

-- Details of customers

SELECT * FROM customer;

-- stock that is to be bought where quantity goes down a specific amount

-- assuming that the minimum quantity is 20, if goes down 20 that product is to be bought

SELECT * FROM stock WHERE quantity <= 20;

Add a comment
Know the answer?
Add Answer to:
This is third time im posting this Question COURSE; introduction to database Please, No handwriting thanks...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is third time im posting this Question COURSE; introduction to database Please, No handwriti...

    This is third time im posting this Question COURSE; introduction to database Please, No handwriting thanks for your efforts Design the database by following . Execute the sample requested queries. . ER Diagram. . All schemas before and after normalization. . All SQL statements of: -Creating tables. - Inserting data in tables. -Queries. 5. Screenshots from MySQL (or any other software you use) Question is - Database system for a Wholesale Management System Consider a database system for a Wholesale...

  • Please help me to solve Please, No handwriting COURSE; introduction to database Q- write a query ...

    Please help me to solve Please, No handwriting COURSE; introduction to database Q- write a query SQL by Using the info below A. Normalize the Tables (in 3NF at least) B. Create the Normalized Tables and Populate them with at least 5 Rows C. Write the Wholesale Management System requested Queries & Execute them VERY IMPORTANT Screenshots from MySQL (or any other software you use) of all the tables after queries result. - Database system for a Wholesale Management System...

  • There are five categories of data to be stored in the database: Ingredients Ingredient Name Amount...

    There are five categories of data to be stored in the database: Ingredients Ingredient Name Amount in Stock Menu Items Menu Item Name Ingredients Regular Price Sale Price Customers Customer Name Customer Address Ingredients Allergic To Employees Social Security Number Employee Name Employee Address Hourly Wage Sales Data Transaction Date and Time Server (i.e. Employee) ID Customer ID Menu Items Sold Price Each Item Sold At 3. (30 points) Based on the relational model you provided as your answer to...

  • Please, No handwriting COURSE; introduction to database thank you for your efforts and time The f...

    Please, No handwriting COURSE; introduction to database thank you for your efforts and time The following set of schemas is given: Customer (name, age, gender) Visit (name, store) Receipt (name, product) Offer (store, product, price) Write the following queries in relational algebra, using the above schema: 1. Find all stores visited by at least one customer under the age of 18. 2. Find the names of all females who bought either product # 1 or product #2. 3. Find all...

  • Database Exercise I (50 pts): This exercise deals with a database that stores information about Hotel...

    Database Exercise I (50 pts): This exercise deals with a database that stores information about Hotel Management System. Customer (C email, name, country) Payment (Invoice id, C email, payment method, date) invoice (Invoice id, starus, invoice description) Has (Bill id. Invoice id) 9a Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id, room id, C email, date, period, reservation id) Rooms(Hotel id. room id, price, category) Hotel (Hotel id. H name. country) Own (room id,...

  • Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587...

    Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587 When all of your queries are complete, cut and paste the SQL Syntax into a word document. In order to see what the column names are, you need to click on the table and then Columns to see the field names. Make sure to include column headings that make sense in the queries (use the as “Field Name” after the field selected). Multi-table Queries...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

  • Exercise 3 [12.5 marks] Given the Restaurant management system database that contains the following tables (primary...

    Exercise 3 [12.5 marks] Given the Restaurant management system database that contains the following tables (primary keys are underlined and foreign keys are preceded with #): Customer (customerID,customerFirstName,customerLastName,customerAddress) Oreder (orderID,orderDate, #customerID,#menuItemID,#staffID) MenuItem(menuItemID, menuItemName,ingredients,type,availability) Staff(staffID, staffName, staffPhoneNumber, staffRole ) OrderPayment(paymentID,paymentAmount,#orderID,#staffID) 1) Without using DISTINCT, write the SQL query equivalent to the following one:[1.5 marks] SELECT DISTINCT menuItemName FROM MenuItem WHERE type = ‘Vegetarian’ OR availability= ‘Yes’; 2) Express the following queries in SQL: a) Find the number of orders placed by...

  • The Northwind database created by Microsoft contains the sales data for a fictitious company called Northwind...

    The Northwind database created by Microsoft contains the sales data for a fictitious company called Northwind Traders, which imports and exports specialty foods from around the world. Here is the schema of the database: Products (ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued); Suppliers (SupplierID, CompanyName, ContactName , ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax, HomePage); Categories (CategoryID, CategoryName, Description, Picture); Orders (OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia,  Freight, ShipName,ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry); Order_details (ID, OrderID,...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT