How to create function with Return Type as (TABLE student_name string)
Either by using returns table

create function get_students()
 returns table(applicant_id integer, ship_id integer)
as
$$
  select applicant_id, ship_id
  from test.students
$$
language sql;




create function get_student_names()
 returns table(student_name text)
as
$$
  select name
  from test.students
$$
language sql;


Or by using setof

create function get_students
 returns setof students
as
$$
  select *
  from test.students
$$
language sql;