Lets say we added a layer in QGIS named "Vegir".
In the left panel double click on the layer, and the box "Layer Properties" appears.
In the left panel choose "Style".
Choose "Single Symbol".
As we now can see, there are plenty of possibilities to set up the look of the lines.
This time we will set the colors by type of the road.
Thats why we choose "Categorized".
Under "Column" we choose the column in the database table, which we want to group by. In our example it is "slag".
We choose a "Color ramp" by our own choice.
Click on "Classify" and we are getting a list of road types and colors.
We will also make the lines a little thicker. Click on the "Change" button and a box named "Symbol selector" appears.
We are setting "Width" to "2".
And now the roads got color by type of road.
You are welcome to write comments below. If you have any questions, please post in the forum.