🙏 We need your help! SQLtest.online has no ads and lives only on donations. Even a small amount helps. Donate now →
SQL code copied to buffer
Task 14:

Sales People from Domain Logins

SQL Server 2022
The SalesPerson column of the Customer table holds a Windows login with the domain: adventure-works\pamela0. The CRM wants it in two parts: login, the part after the backslash (pamela0), and display_name, the login without its last character (a digit) and with a capital first letter (Pamela).
Output the columns login and display_name for every sales person once, sorted by login.
Expected result Columns: 2 · Rows: 9
login display_name

Sample rows open after wrong checks: 0 of 2

Write your query below and click "Check it!". Tables are described in the right pane.

Tutorial

By checking a query, you agree that it is stored without your account details and may be included in anonymized datasets, including for AI training. Learn more

The query result will appear here. Ctrl+Enter - Run query