How to display one name in three tables many-to-many relationship? I have three tables (student's_info, subjects and marks):

This is student's_info:

----------------
|s_id | s_name |
----------------
| 1   | Liza   |
| 2   | Jake   |
----------------


This is subjects:

------------------
|sub_id | subject|
------------------
| 1   | Word     |
| 2   | Windows  |
| 3   | Excel    |
------------------


and this is marks:

-----------------------------------
|id | s_id |sub_id| n1  | n2 | n3 |
-----------------------------------
| 1 |  1   |  1   |  50 | 20 | 10 |
| 2 |  1   |  2   |  44 | 33 | 23 |
| 3 |  1   |  3   |  90 | 44 | 31 |
| 4 |  2   |  1   |  32 | 12 | 11 |
| 5 |  2   |  2   |  56 | 28 | 32 |
| 6 |  2   |  3   |  66 | 33 | 44 |
-----------------------------------


I have this query to select data:

SELECT students_info.*, marks.*, subjects.subject
  FROM subjects
         RIGHT JOIN (students_info
                       RIGHT JOIN marks ON students_info.s_id = marks.s_id
                    ) ON subjects.sub_id = marks.sub_id";


The query result is:

Liza  Word     50 20 10
Liza  Windows  44 33 23
Liza  Excel    90 44 31
Jake  Word     32 12 11
Jake  Windows  56 28 21
Jake  Excel    66 33 44


My question is: Why is the sutdent's name repeated? How can I get blank out the student's name if it's the same as in the previous row?
This is normal behavior in any database. The value "Liza" shows on each line because it's the value from student's_info.s_name for the rows being shown.

You want to suppress the information to improve the presentation of the data (i.e., the way it looks). This is why Michael Kutz calls it a "Display Tier" problem.

The data being returned from the query is exactly correct; you want to modify it when you go to display it to an end user. Generally, it's recommended that this sort of thing be handled by the application that's going to deliver the data to said end user.

There are ways to manipulate the result set to not display the student's name if it's the same as it was on the previous row, if for some reason you cannot do it in the application. However, they result in a more complicated query.

I've put together a query that seems to work, with the sample data at least. You can see it in action at this DB-Fiddle. Note that I've tweaked your names slightly (the apostrophe/single quote character is almost always used to mean something in SQL, so I'd avoid it in an object name).

The fiddle shows the results - as you desired, the first row for each student shows their name, and the following rows for the same student leave the name blank.

Here's the query:

SELECT s_name_display, sub_name, n1, n2, n3
  FROM (SELECT if(@last_s_name = s_name, '', s_name) as s_name_display
              ,@last_s_name := s_name as name_set_to
              ,sub_name
              ,n1,n2,n3
              ,@row_number := @row_number + 1 as sort_id
          FROM (        
                SELECT student.s_name
                      ,subject.sub_name
                      ,marks.n1, marks.n2, marks.n3
                  FROM subject
                         RIGHT JOIN (student
                                       RIGHT JOIN marks ON student.s_id = marks.s_id
                                    ) ON subject.sub_id = marks.sub_id
                 ORDER BY student.s_name, subject.sub_name
                ) base
       ) sq
 ORDER BY sort_id
;


The subquery named base is your original query. We sort the data in the desired order here.

The subquery sq uses base with two variables. One, @last_s_name, holds the s_name from the previous row. @row_number is used to set a row number - we want to be certain that the final output is shown in the same order as what we have here, since row order is critical (the first appearance of each student name has to come before the other rows with that student's name).

We determine the name to display by comparing the student name from the previous row with the student name in the current row. If they're the same, we return an empty string as s_display_name; otherwise, we return the actual s_name.

Finally, we select just the columns we want from the sq subquery, and make sure they're sorted correctly in the outermost query.

Like I said - this is much more complicated than your original query. For that matter, I can't guarantee that this will scale - merely that it works fine with your sample data.