Hi! Could we please enable some services and cookies to improve your experience and our website?
Privacy & Cookie Policy.From table ProductCategory select list of categories with their sub-categories. Output the result in two columns Category - the name of root category and SubCategories - a sorted list of the names of all subcategories separated by a comma with one space (,). Sort the result by first column.
Use SQL Server 2022 syntax to write your answer. Descriptions of tables are provided in the right pane.
Write your request in the field below and click the "Check it!" button.The AdventureWorks Database is a sample database that demonstrates the capabilities of SQL Server. It includes data about fictional manufacturing company.
| AddressID | AddressLine1 | AddressLine2 | City | StateProvince | CountryRegion | PostalCode | rowguid | ModifiedDate |
|---|---|---|---|---|---|---|---|---|
| 9 | 8713 Yosemite Ct. | null | Bothell | Washington | United States | 98011 | 268AF621-76D7-4C78-9441-144FD139821A | 2006-07-01 00:00:00.000 |
| CustomerID | NameStyle | Title | FirstName | MiddleName | LastName | Suffix | CompanyName | SalesPerson | EmailAddress | Phone | PasswordHash | PasswordSalt | rowguid | ModifiedDate |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0 | Mr. | Orlando | N. | Gee | [null] | A Bike Store | adventure-works\pamela0 | orlando0@adventure-works.com | 245-555-0173 | L/Rlwxzp4w7RWmEgXX+/A7cXaePEPcp+KwQhl2fJL7w= | 1KjXYs4= | 3F5AE95E-B87D-4AED-95B4-C3797AFCB74F | 2005-08-01 00:00:00.000 |
| CustomerID | AddressID | AddressType | rowguid | ModifiedDate |
|---|---|---|---|---|
| 29485 | 1086 | Main Office | 16765338-DBE4-4421-B5E9-3836B9278E63 | 2007-09-01 00:00:00.000 |
| ProductID | Name | ProductNumber | Color | StandardCost | ListPrice | Size | Weight | ProductCategoryID | ProductModelID | SellStartDate | SellEndDate | DiscontinuedDate | ThumbNailPhoto | ThumbnailPhotoFileName | rowguid | ModifiedDate |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 680 | HL Road Frame - Black, 58 | FR-R92B-58 | Black | 1059.3100 | 1431.5000 | 58 | 1016.04 | 18 | 6 | 2002-06-01 00:00:00.000 | [null] | [null] | [binary] | no_image_available_small.gif | 43DD68D6-14A4-461F-9069-55309D90EA7E | 2008-03-11 10:01:36.827 |
| ProductCategoryID | ParentProductCategoryID | Name | rowguid | ModifiedDate |
|---|---|---|---|---|
| 1 | [null] | Bikes | CFBDA25C-DF71-47A7-B81B-64EE161AA37C | 2002-06-01 00:00:00.000 |
| ProductDescriptionID | Description | rowguid | ModifiedDate |
|---|---|---|---|
| 4 | Aluminum alloy cups; large diameter spindle. | DFEBA528-DA11-4650-9D86-CAFDA7294EB0 | 2007-06-01 00:00:00.000 |
| ProductModelID | Name | CatalogDescription | rowguid | ModifiedDate |
|---|---|---|---|---|
| 1 | Classic Vest | [null] | 29321D47-1E4C-4AAC-887C-19634328C25E | 2007-06-01 00:00:00.000 |
| ProductModelID | ProductDescriptionID | Culture | rowguid | ModifiedDate |
|---|---|---|---|---|
| 1 | 1199 | en | 4D00B649-027A-4F99-A380-F22A46EC8638 | 2007-06-01 00:00:00.000 |
| SalesOrderID | SalesOrderDetailID | OrderQty | ProductID | UnitPrice | UnitPriceDiscount | LineTotal | rowguid | ModifiedDate |
|---|---|---|---|---|---|---|---|---|
| 71774 | 110562 | 1 | 836 | 356.8980 | .0000 | 356.898000 | E3A1994C-7A68-4CE8-96A3-77FDD3BBD730 | 2008-06-01 00:00:00.000 |
| SalesOrderID | RevisionNumber | OrderDate | DueDate | ShipDate | Status | OnlineOrderFlag | SalesOrderNumber | PurchaseOrderNumber | AccountNumber | CustomerID | ShipToAddressID | BillToAddressID | ShipMethod | CreditCardApprovalCode | SubTotal | TaxAmt | Freight | TotalDue | Comment | rowguid | ModifiedDate |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 71774 | 2 | 2008-06-01 00:00:00.000 | 2008-06-13 00:00:00.000 | 2008-06-08 00:00:00.000 | 5 | 0 | SO71774 | PO348186287 | 10-4020-000609 | 29847 | 1092 | 1092 | CARGO TRANSPORT 5 | [null] | 880.3484 | 70.4279 | 22.0087 | 972.7850 | [null] | 89E42CDC-8506-48A2-B89B-EB3E64E3554E | 2008-06-08 00:00:00.000 |