w3resource
SQL exercises

SQL Exercises: Salesmen commission with the percent sign ( % )

SQL Formatting Output: Exercise-1 with Solution

Write a SQL statement to display the commission with the percent sign ( % ) with salesman ID, name and city columns for all the salesmen.

Sample table: salesman


Sample Solution :

SELECT salesman_id,name,city,'%',commission*100 
FROM salesman;

Output of the Query:

salesman_id	name		city		?column?	?column?
5001		James Hoog	New York	%		15.00
5002		Nail Knite	Paris		%		13.00
5005		Pit Alex	London		%		11.00
5006		Mc Lyon		Paris		%		14.00
5007		Paul Adam	Rome		%		13.00
5003		Lauson Hen	San Jose	%		12.00

Explanation:

Syntax of display the commission with the percent sign

Pictorial presentation :

Result of display the commission with the percent sign

Query Visualization:

Duration:

Query visualization of Salesmen commission with the percent sign ( % ) - Duration

Rows:

Query visualization of Salesmen commission with the percent sign ( % ) - Rows

Cost:

Query visualization of Salesmen commission with the percent sign ( % ) - Cost

 

Practice Online


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: SQL Formatting Output Exercises Home
Next: Write a SQL statement to find out the number of orders booked for each day and display it in such a format like "For 2001-10-10 there are 15 orders".

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming