2. Based on Table 1 and Table 2, write Transact-SQL queries to answer the following questions. Provide the output of each query. (Hint: Use Microsoft SQL Server to write query) Table 1: PAINTING Painting No Title 2018 2023 2041 2942 2045 2103 Dawn Thunder The Starry Night Sunrise The Night Cafe The Gardener Sunset Table 2: PAINTER Painter No Title 10014 Mr 10015 10016 Ms Mr Name Johan Anne Michael Painter No 10016 10015 10015 10014 10015 10014 Phone 844-2573 894-1238 Null Gallery No Price (RM) 18 1000 18 1600 23 24 18 24 Email 900 7000 5600 2000 johan@gmail.com anne@gmail.com michael@gmail.com a) Write a query to display painter name and Contact column that contains phone number if known, otherwise email address. b) Identify the top three expensive painting. Show the painting title and unit price to complete the query.

icon
Related questions
Question
2. Based on Table 1 and Table 2, write Transact-SQL queries to answer the following questions.
Provide the output of each query. (Hint: Use Microsoft SQL Server to write query)
Table 1: PAINTING
Painting No
2018
2023
2041
2942
2045
2103
Title
Dawn Thunder
The Starry Night
Sunrise
The Night Cafe
The Gardener
Sunset
Table 2: PAINTER
Painter No Title
10014
10015
10016
Mr
Ms
Mr
Name
Johan
Anne
Michael
Painter_No
10016
10015
10015
10014
10015
10014
Phone
844-2573
894-1238
Null
Gallery No
18
18
23
24
18
24
Email
Price (RM)
1000
1600
900
7000
5600
2000
johan@gmail.com
anne@gmail.com
michael@gmail.com
a) Write a query to display painter name and Contact column that contains phone
number if known, otherwise email address.
b) Identify the top three expensive painting. Show the painting title and unit price to
complete the query.
Transcribed Image Text:2. Based on Table 1 and Table 2, write Transact-SQL queries to answer the following questions. Provide the output of each query. (Hint: Use Microsoft SQL Server to write query) Table 1: PAINTING Painting No 2018 2023 2041 2942 2045 2103 Title Dawn Thunder The Starry Night Sunrise The Night Cafe The Gardener Sunset Table 2: PAINTER Painter No Title 10014 10015 10016 Mr Ms Mr Name Johan Anne Michael Painter_No 10016 10015 10015 10014 10015 10014 Phone 844-2573 894-1238 Null Gallery No 18 18 23 24 18 24 Email Price (RM) 1000 1600 900 7000 5600 2000 johan@gmail.com anne@gmail.com michael@gmail.com a) Write a query to display painter name and Contact column that contains phone number if known, otherwise email address. b) Identify the top three expensive painting. Show the painting title and unit price to complete the query.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer