MySQL String Exercises: Display the first word from the job titles which contains more than one words
MySQL String: Exercise-12 with Solution
Write a query to display the first word from those job titles which contains more than one words.
Sample table: jobs
Code:
SELECT job_title, SUBSTR(job_title,1, INSTR(job_title, ' ')-1)
FROM jobs;
Sample Output:
job_title SUBSTR(job_title,1, INSTR(job_title, ' ')-1) President Administration Vice President Administration Administration Assistant Administration Finance Manager Finance Accountant Accounting Manager Accounting Public Accountant Public Sales Manager Sales Sales Representative Sales Purchasing Manager Purchasing Purchasing Clerk Purchasing Stock Manager Stock Stock Clerk Stock Shipping Clerk Shipping Programmer Marketing Manager Marketing Marketing Representatives Marketing Human Resources Representative Human Public Relations Representative Public
MySQL Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous:Write a query to get the locations that have minimum street length.
Next:Write a query to display the length of first name for employees where last name contain character 'c' after 2nd position.
What is the difficulty level of this exercise?
- 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