4>
5>
6> CREATE TABLE Employees (
7> EmployeeID int NOT NULL ,
8> LastName nvarchar (20) NOT NULL ,
9> FirstName nvarchar (10) NOT NULL ,
10> Title nvarchar (30) NULL ,
11> TitleOfCourtesy nvarchar (25) NULL ,
12> BirthDate datetime NULL ,
13> HireDate datetime NULL ,
14> Address nvarchar (60) NULL ,
15> City nvarchar (15) NULL ,
16> Region nvarchar (15) NULL ,
17> PostalCode nvarchar (10) NULL ,
18> Country nvarchar (15) NULL ,
19> HomePhone nvarchar (24) NULL ,
20> Extension nvarchar (4) NULL ,
21> Photo image NULL ,
22> Notes ntext NULL ,
23> ReportsTo int NULL ,
24> PhotoPath nvarchar (255) NULL
25>
26> )
27> GO
1>
2>
3> SELECT ReportsTo AS Manager, COUNT(*) AS Reports
4> FROM Employees
5> WHERE EmployeeID != 5
6> GROUP BY ReportsTo
7>
8> GO
Manager Reports
----------- -----------
(0 rows affected)
1>
2> drop table Employees;
3> GO
1>
|