Add SQL JOIN types against multiple tables in SQL Server

With a SQL statement, we can use the JOIN statement to join multiple tables to a database query.

Two commonly used JOIN types that are used in SQL Server are INNER JOIN and LEFT JOIN.

Take these users and roles data:


Id Name RoleId
1 Dave 1
2 Roger 2
3 Pavan 2
4 Thierry NULL


Id Name
1 Administrator
2 Editor

Write a SQL statement that will return all users and their role. For table names, use User for the user table and Role for the role table. You'll need to use one of the JOIN methods to JOIN the User table with the Role table. Remember to only include the columns you need in the statement.