Tuesday, July 5, 2011

Re: [ vuZs.net ] CS403 Assignment#5 idea solution

Consider reviewing your solution Following, is from my side.



 
Create a view to show all the supplier names along with their Supplier IDs

CREATE VIEW Sampleview AS SELECT supplier_name , supplier_id from supplier;

Create a view to show the supplier name and supplier ID, who provide the product "Mirrors"

CREATE VIEW Sampleview2 AS 
SELECT supplier.supplier_name , supplier.supplier_id 
FROM supplier,product,category where
supplier.supplier_id = category.supplier_id and 
category.category_id = product.category_id and 
product_name = 'Mirrors'

Create a view to list down all the product names with their category names.

CREATE VIEW Prod_cate AS SELECT Product_name, Category_name FROM
 product,category where
category.category_id = product.category_id 

Update view to change the Supplier name from "AB Hardwares" to "Uplink Hardwares".

We can update the data of any view by changing the data in base tables. This way it will update the data into all the views which are based on those tables.

UPDATE supplier set supplier_name = "Uplink Hardware" where supplier_name = "AB Hardwares" 

Regards

Zubair Hussain
www.vuzs.net



On Tue, Jul 5, 2011 at 10:32 AM, mc100201820 <mc100201820@vu.edu.pk> wrote:
Anyone plz confirm this solution:

1. Create a view to show all the supplier names along with their Supplier IDs


Answer: SELECT [supplier-name],[supplier-ID] FROM supplier


2. Create a view to show the supplier name and supplier ID, who provide the product "Mirrors".

Answer:
SELECT [supplier-name],[supplier-ID] FROM product, category, supplier
WHERE supplier.[supplier-ID] = category.[supplier-ID] and
category.[category-ID] = product.[category.ID] and
product. product-name = "Mirrors"

3. Create a view to list down all the product names with their category names

Answer:
SELECT [product-name],[category-name] FROM product, category
WHERE product.[category-ID] = category.[category-ID]

4. Update view to change the Supplier name from "AB Hardwares" to "Uplink Hardwares".


Answer:
UPDATE supplier SET supplier-name = "Uplink Hardwares"
WHERE supplier-name = "AB Hardwares"

--
--
Please visit www.vuzs.net For Current & Old Papers, Quizzes, Assignments and study material.
--
You received this message because you are subscribed to the Google
Groups "vuZs" group.
--
To post a new message on this group, send email to vuZs@googlegroups.com
--
Message Posting Rules: http://vuzs.net/faq/4795-vuzs-google-groups-basic-rules-for-posting-messages.html
--
To unsubscribe from this group, send email to vuZs+unsubscribe@googlegroups.com
--
To join this group Send blank email from your virtual university email address to
vuZs+subscribe@googlegroups.com
or visit
http://groups.google.com/group/vuZs/subscribe
---
For more information Contact vuZs Manager at info@vuzs.net

--
--
Please visit www.vuzs.net For Current & Old Papers, Quizzes, Assignments and study material.
--
You received this message because you are subscribed to the Google
Groups "vuZs" group.
--
To post a new message on this group, send email to vuZs@googlegroups.com
--
Message Posting Rules: http://vuzs.net/faq/4795-vuzs-google-groups-basic-rules-for-posting-messages.html
--
To unsubscribe from this group, send email to vuZs+unsubscribe@googlegroups.com
--
To join this group Send blank email from your virtual university email address to
vuZs+subscribe@googlegroups.com
or visit
http://groups.google.com/group/vuZs/subscribe
---
For more information Contact vuZs Manager at info@vuzs.net

No comments:

Post a Comment