Question

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

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

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');

  • 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;

ER Diagram : -

Name Name Buyerld Quantity ID Address Buyer STOCK H Stockld ayment dueDate PaymentStatus Details Customer ID Address Name

Tables

Before Normalization

Stock(Id, Name, Quantity)

Customer(Id, Name, Address)

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

After normalization

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

Stock(Id, Name, Quantity)

Customer(Id, Name, Address)

Buyer(BuyerId, StockId, DueDate, PaymentStauts)

Add a comment
Know the answer?
Add Answer to:
Please help me to solve Please, No handwriting COURSE; introduction to database Q- write a query ...
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 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...

  • 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...

  • 2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query...

    2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query the following Hotel Room Booking Database Tables. "cid" is Customer ID. "rid" is Room ID. "bid" is Booking ID. "dob" means Date of Vwwww Birth; "beds" means the number of beds in the room which is normally 1 or 2 beds. "DueDate" and "DueAmount" are the payment due dates and due amounts of this booking. Customers fname name phone email cid dob zipcode Rooms...

  • 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...

  • 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,...

  • can someone solve these quick please and thank you! sql chapter 4 Query #1: List the...

    can someone solve these quick please and thank you! sql chapter 4 Query #1: List the company name, contact name, contact title and the phone number for customers who HAVE NOT put in an order. Use an outer join. Query #2: Create a listing displaying the employee first name, last name and the full name (First name space Last Name) of the person they report to (Supervisor). This is a self-join. If an employee does not report to anyone then...

  • 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...

  • 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...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • Problem 33, chapter 7 from Database Systems 13th edition by Coronel Write a query to display...

    Problem 33, chapter 7 from Database Systems 13th edition by Coronel Write a query to display the employee number, last name, email address, title, and department name of each employee whose job title ends in the word “ASSOCIATE.” Sort the output by department name and employee title Problem 36, chapter 7 from Database Systems 13th edition by Coronel Write a query to display the number of products within each base and type combination, sorted by base and then by type...

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