Q:

Is this mysql query correct for getting data from two tables

SELECT r.`root_cat_name`,
       r.`root_cat_id`,
       s.`sub_cat_name`,
       s.`sub_cat_id`
  FROM `root_category` AS r
    INNER JOIN `sub_category` AS s ON r.`root_cat_id` = s.`sub_cat_id`
  ORDER BY r.`root_cat_id` DESC

I want to get data from 2 tables in which root_cat_id is the primary key.
I want to show all sub-categories.
root cat: 
id  root_cat_name
--  -----
1   item1
2   item2

subcat:
id  root_cat_id sub_cat_name
--  ----------- ------
1   1           abc
2   1           sadj
3   2           asd
4   1           asdasd

A:

Does this work :
SELECT r.root_cat_name,
    r.root_cat_id,
    s.sub_cat_name,
    s.sub_cat_id
FROM root_category AS r
INNER JOIN sub_category AS s ON r.id = s.root_cat_id
ORDER BY r.id DESC

everything in 'r' must be column names from root_category, everythin in 's' must be column names in sub_category

