Skip to content

Dev#1

Open
AbeerAhmad2003 wants to merge 21 commits into
mainfrom
dev
Open

Dev#1
AbeerAhmad2003 wants to merge 21 commits into
mainfrom
dev

Conversation

@AbeerAhmad2003

Copy link
Copy Markdown
Owner

No description provided.

Comment thread queries/createIndexes.sql
Comment on lines +1 to +3



Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for these leading spaces

Comment on lines +22 to +25
SELECT dbo.fn_CalculateEmployeeSalary(2) AS SalaryForEmployee2;



Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove additional spaces

Comment thread schema/01_Restaurants.sql
Name NVARCHAR(100),
Address NVARCHAR(200),
PhoneNumber NVARCHAR(20),
OpeningHours NVARCHAR(100)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decimal looks as better type here

DECLARE @Month INT = 5;


;WITH ItemsInMonth AS (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra comma

JOIN MenuItems mi ON oi.ItemId = mi.ItemId
WHERE YEAR(o.OrderDate) = @Year AND MONTH(o.OrderDate) = @Month
GROUP BY mi.RestaurantId, mi.ItemId, mi.Name
),Ranked AS (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separating queries by adding one line between each two, would make it easier to understand.

SELECT emp.EmployeeId,emp.FirstName,emp.LastName, AVG(TotalAmount) AS AvgAmount
FROM Orders o
join Employees emp
on o.EmployeeId=emp.EmployeeId

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add space before and after =

Comment thread schema/07_Orders.sql
@@ -0,0 +1,7 @@
CREATE TABLE Orders (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OrderId INT IDENTITY(1,1) PRIMARY KEY,   -- auto-increment starts at 1, increases by 1

So you will not need helper method to determine the id .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants