- Home
- .NET coding challenges
- Add SQL JOIN types against multiple tables in SQL Server
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:
User
Id | Name | RoleId |
---|---|---|
1 | Dave | 1 |
2 | Roger | 2 |
3 | Pavan | 2 |
4 | Thierry | NULL |
Role
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.
Latest challenges
![Work out the number of days between two dates](/media/uzyksmqi/codingchallengedaystogo.png?width=350&height=197&v=1da1a4cba8891c0)
Work out the number of days between two dates
Write a C# function to work out the difference between two dates and return the number of days in this coding challenge.
Contains online code editor
![Removing the last character from a string](/media/av2lvfyl/codingchallengelastcharacter.png?width=350&height=197&v=1da14a72f0f3270)
Removing the last character from a string
This coding challenge involves writing a C# method that will removing the last character from a string and returning the value.
Contains online code editor