안녕하세요 이제 막 대학 졸업하고 취직 한 학생인데요
회사에서 SQL을 배우라고 해서 배우는 중인데 이거 정답 맞나요?
1. write T-SQL query to return how many roles are assigned to the user with FirstName 'Dianna'
select count(ur.UserRoleID)
from UserRoles ur inner join Users u on ur.UserID = u.UserID
where u.FirstName like 'Diana'
2. Write T-SQL query to return the RoleName of the role with only one user assigned.
select ur.RoleName
from UserRoles ur inner join Roles on ur.RoleID = u.RoleID
Group by ur.RoleName
having count(ur.RoleID) = 1
3. Write T-SQL query to return the most common EmailAdress in the user Table.
select EmailAddress, count(EmailAddress) as occurance
from Users
Group by EmailAddress
Order by occurance desc
이렇게 풀었는데 이게 정답 맞나요??
그리고 이렇게 하니까 3번째 꺼는 여러줄을 가지고오는데 전 한줄만 가지고 오고 싶거든요 그땐 어떻게 해야하나요?'
감사합니다.