SQLite Exercise: Get the length of the employee names from employees table
Write a query to get the length of the employee names (first_name, last_name) from employees table.
Sample table : employees
SQLite Code :
SELECT first_name,last_name, LENGTH(first_name)+LENGTH(last_name) 'Length of Names'
FROM employees;
Output:
first_name last_name Length of Names ---------- ---------- ---------------- Steven King 10 Neena Kochhar 12 Lex De Haan 10 Alexander Hunold 15 Bruce Ernst 10 David Austin 11 Valli Pataballa 14 Diana Lorentz 12 Nancy Greenberg 14 Daniel Faviet 12 John Chen 8 Ismael Sciarra 13 Jose Manue Urman 16 Luis Popp 8 Den Raphaely 11 Alexander Khoo 13 Shelli Baida 11 Sigal Tobias 11 Guy Himuro 9 Karen Colmenares 15 Matthew Weiss 12 Adam Fripp 9 Payam Kaufling 13 Shanta Vollman 13 Kevin Mourgos 12 Julia Nayer 10 Irene Mikkilinen 16 James Landry 11 Steven Markle 12 Laura Bissot 11 Mozhe Atkinson 13 James Marlow 11 TJ Olson 7 Jason Mallin 11 Michael Rogers 13 Ki Gee 5 Hazel Philtanker 15 Renske Ladwig 12 Stephen Stiles 13 John Seo 7 Joshua Patel 11 Trenna Rajs 10 Curtis Davies 12 Randall Matos 12 Peter Vargas 11 John Russell 11 Karen Partners 13 Alberto Errazuriz 16 Gerald Cambrault 15 Eleni Zlotkey 12 Peter Tucker 11 David Bernstein 14 Peter Hall 9 Christophe Olsen 16 Nanette Cambrault 16 Oliver Tuvault 13 Janette King 11 Patrick Sully 12 Allan McEwen 11 Lindsey Smith 12 Louise Doran 11 Sarath Sewall 12 Clara Vishney 12 Danielle Greene 14 Mattea Marvins 13 David Lee 8 Sundar Ande 10 Amit Banda 9 Lisa Ozer 8 Harrison Bloom 13 Tayler Fox 9 William Smith 12 Elizabeth Bates 14 Sundita Kumar 12 Ellen Abel 9 Alyssa Hutton 12 Jonathon Taylor 14 Jack Livingston 14 Kimberely Grant 14 Charles Johnson 14 Winston Taylor 13 Jean Fleaur 10 Martha Sullivan 14 Girard Geoni 11 Nandita Sarchand 15 Alexis Bull 10 Julia Dellinger 14 Anthony Cabrio 13 Kelly Chung 10 Jennifer Dilly 13 Timothy Gates 12 Randall Perkins 14 Sarah Bell 9 Britney Everett 14 Samuel McCain 12 Vance Jones 10 Alana Walsh 10 Kevin Feeney 11 Donald OConnell 14 Douglas Grant 12 Jennifer Whalen 14 Michael Hartstein 16 Pat Fay 6 Susan Mavris 11 Hermann Baer 11 Shelley Higgins 14 William Gietz 12
Practice SQLite Online
Model Database
Structure of 'hr' database :
Improve this sample solution and post your code through Disqus.
Previous: Write a query to get first name from employees table after removing white spaces from both side.
Next: Write a query to select first 10 records from a table.
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