Question [1]: [5 marks] Write the suitable SQL statement to answer the following questions based on the following relations: Note: Show screen shot of the query together with the output in SQL environment. Product ProductID 1 2 3 4 Supplier 5 6 Supplier ID 1023 1145 2451 4566 1342 ProductName Bread Juice Cheese Yogurt Milk Croissant Supplier Name Lusine Nadec AlMarai AlSafi Nova ProductPrice 6.5 10 23 3 7.75 2 Supplier ID 1023 1145 2451 1145 1145 1023 ProductNum 5 12 3 4 1 1. Write the DDL statements for defining all the relations. [1 mark] 2. Write the DML statements for inserting all the tuples listed in the above relations state. [0.5 mark] 3. Write an SQL query to raise the price of all products by 9%. [1 mark] 4. Write an SQL query to list all details of all products from Nadec supplier. (Nested Query). [1 mark] 5. List the number of products for each supplier that supplies more than 1 product. [1 mark] 6. Drop all the tables. [0.5 mark]
SQL
SQL stands for Structured Query Language, is a form of communication that uses queries structured in a specific format to store, manage & retrieve data from a relational database.
Queries
A query is a type of computer programming language that is used to retrieve data from a database. Databases are useful in a variety of ways. They enable the retrieval of records or parts of records, as well as the performance of various calculations prior to displaying the results. A search query is one type of query that many people perform several times per day. A search query is executed every time you use a search engine to find something. When you press the Enter key, the keywords are sent to the search engine, where they are processed by an algorithm that retrieves related results from the search index. Your query's results are displayed on a search engine results page, or SER.
![Question [1]: [5 marks]
Write the suitable SQL statement to answer the following questions based on the
following relations:
Note: Show screen shot of the query together with the output in SQL environment.
Product
ProductID
1
2
3
4
5
6
Supplier
Supplier ID
1023
1145
2451
4566
1342
ProductName
Bread
Juice
Cheese
Yogurt
Milk
Croissant
Supplier Name
Lusine
Nadec
AlMarai
AlSafi
Nova
ProductPrice
6.5
10
23
3
7.75
2
Supplier ID
1023
1145
2451
1145
1145
1023
ProductNum
5
12
3
4
1. Write the DDL statements for defining all the relations. [1 mark]
2. Write the DML statements for inserting all the tuples listed in the above relations
state. [0.5 mark]
3. Write an SQL query to raise the price of all products by 9%. [1 mark]
4. Write an SQL query to list all details of all products from Nadec supplier. (Nested
Query). [1 mark]
5. List the number of products for each supplier that supplies more than 1 product. [1
mark]
6. Drop all the tables. [0.5 mark]](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ffa4ba62c-e05f-4e57-a7c8-7104e5d82419%2F7a6decae-d70a-4857-b2b3-119f8fbf32c1%2F3eoticd_processed.jpeg&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 9 images









