Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

customer ( customerID , firstName, lastName, city ) supplier ( supplierID , name, street, city, phone, email ) product ( productID , name, unit _

customer(customerID, firstName, lastName, city)
supplier(supplierID, name, street, city, phone, email)
product(productID, name, unit_price, stock, supplierID)
customerorder(customerID, productID, odate, quantity) Assuming a PostgreSQL environment, write SQL code for each of the following:
(a) Give the details of products with a stock of less than 5.
[2 marks]
(b) Give the details of products whose name contains kettle.
[2 marks]
(c) For each supplierID, give the number of products supplied.
[3 marks]
(d) List the details of products supplied by supplier whose name is Galaxy.Assume all tables have been created except for customerorder. Create the
table customerorder. The data type for customerID and productID is
VARCHAR(5).
Ensure you choose appropriate data types for the other columns, and you
specify the primary key and any foreign keys. [6 marks]
(f) Delete records in the customerorder that dates up to the end of December
2009.[2 marks]
(g) Create a view containing the productID, its name and stock. [3 marks]
(h) Give user john permission to access (read only) the view created in part (g).
You may assume that user john has already been created.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions