C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
MySQL last functionMySQL last function is used to return the last value of the selected column. Syntax: SELECT column_name FROM table_name ORDER BY column_name DESC LIMIT 1; MySQL last function exampleConsider a table "officers" having the following data. Execute the following query: SELECT officer_name FROM officers ORDER BY officer_id DESC LIMIT 1; This query will return the last officer_name ordering by officer_id. Output: Return the last officer_name ordering by officer_name: SELECT officer_name FROM officers ORDER BY officer_name DESC LIMIT 1; Output:
Next TopicMySQL Comments
|