SQL Exercises: Salesmen commission with the percent sign ( % )
SQL Formatting Output: Exercise-1 with Solution
From the following table, write a SQL query to select all the salespeople. Return salesman_id, name, city, commission with the percent sign (%).
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
Relational Algebra Expression:

Relational Algebra Tree:

Explanation:

Explanation:

Pictorial presentation :

Practice Online
Query Visualization:
Duration:

Rows:

Cost:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: SQL Formatting Output Exercises Home
Next: From the following table, write a SQL query to find the number of orders booked for each day. Return the result in a format like "For 2001-10-10 there are 15 orders".
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
SQL: Tips of the Day
How to restore a dump file from mysqldump?
It should be as simple as running this:
mysql -u <user> -p < db_backup.dump
If the dump is of a single database you may have to add a line at the top of the file:
USE <database-name-here>;
Ref: https://bit.ly/3xKmyw2
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework