How to list all categories and their IDs using SQL query?

I am looking for a SQL Query that can give the list of all categories created in WordPress Site along with it’s category IDs. Please advise a query to get it as category/term relationship is quite complex in WordPress.

I got this but didn’t work –

SELECT ID,post_title FROM wp_posts INNER JOIN wp_term_relationships ON wp_term_relationships.object_id=wp_posts.ID INNER JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id=wp_term_relationships.term_taxonomy_id INNER JOIN wp_terms ON wp_terms.term_id=wp_term_taxonomy.term_id WHERE name='category'