From ddcf6b37b954874ca940b86c72f7e191706dae83 Mon Sep 17 00:00:00 2001 From: rodrigoosrn Date: Wed, 27 Sep 2017 11:03:13 -0300 Subject: [PATCH] Update 1_questions_and_solutions.sql SQL Server solution using Top instead of limit. --- SQL_exercise_01/1_questions_and_solutions.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SQL_exercise_01/1_questions_and_solutions.sql b/SQL_exercise_01/1_questions_and_solutions.sql index 42ce6d2..9a259da 100644 --- a/SQL_exercise_01/1_questions_and_solutions.sql +++ b/SQL_exercise_01/1_questions_and_solutions.sql @@ -81,6 +81,13 @@ SELECT name,price FROM Products ORDER BY price ASC LIMIT 1; + +--SQL SERVER SOLUTION (T-SQL) +SELECT TOP 1 name + ,price +FROM Products +ORDER BY price ASC + -- 1.16 Select the name of each manufacturer along with the name and price of its most expensive product. select a.Name, max(a.price), b.Name