Purchase Solution

E-R diagram

Not what you're looking for?

Ask Custom Question

(See attached file for full problem description)

---
Using the script file below to create an E-R diagram of the entities, attributes and relationship.

# use the "my_database" database
USE my_database;

# create a table called "items" with 3 records
CREATE TABLE IF NOT EXISTS items
(
id INT PRIMARY KEY,
vendor INT NOT NULL,
name CHAR(20) NOT NULL,
price DECIMAL(6,2) NOT NULL
);
INSERT INTO items (id, vendor, name, price)
VALUES (601, 2, "Elephants", 147.50);
INSERT INTO items (id, vendor, name, price)
VALUES (602, 2, "Reindeers", 123.00);
INSERT INTO items (id, vendor, name, price)
VALUES (603, 1, "Alligators", 185.00);

# create a table called "vendors" with 2 records
CREATE TABLE IF NOT EXISTS vendors
(
id INT PRIMARY KEY,
name CHAR(20) NOT NULL
);
INSERT INTO vendors (id, name) VALUES (1, "Alpha Inc");
INSERT INTO vendors (id, name) VALUES (2, "Zeta Inc");

# create a table called "orders" with 3 records
CREATE TABLE IF NOT EXISTS orders
(
num INT PRIMARY KEY,
item INT NOT NULL,
qty INT NOT NULL
);
INSERT INTO orders (num, item, qty) VALUES (2805, 603, 10);
INSERT INTO orders (num, item, qty) VALUES (2806, 603, 5);
INSERT INTO orders (num, item, qty) VALUES (2807, 601, 10);

# display order number, quantity, item name, vendor
# and total order value of order number 2805
SELECT orders.num AS Number,
orders.qty AS Qty,
items.name AS Toy,
vendors.name AS Vendor,
items.price * orders.qty AS Total
FROM items, vendors, orders
WHERE vendors.id = items.vendor
AND items.id = orders.item
AND orders.num = 2805;

# delete these sample tables
DROP TABLE IF EXISTS items;
DROP TABLE IF EXISTS vendors;
DROP TABLE IF EXISTS orders;
---

Attachments
Purchase this Solution

Solution Summary

The expert creates E-R diagram of the entities.

Purchase this Solution


Free BrainMass Quizzes
Basic Networking Questions

This quiz consists of some basic networking questions.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.