Ayuda con Query Sencillo

Buenas tardes.

 

estoy aprendiendo Oarcle, y tengo una consulta que no se cómo obtenerla.

 

Tengo una tabla llamada estudiantes, que tiene un codigo de la familia y el nombre del estudiante.

 

falimia estudiantes
001  juan
002   jose
002  pedro
002  camilo
003  jorge

Necesito hacer un Query que me muestra algo asi

001  Juan
002  Jose    Pedro    Camilo
003  jorge  

 

Gracias por su ayuda

 

Las consultas del lenguaje SQL se orientan a obtener un número de filas con determinado número de campos o columnas, y ese número es el mismo para todas las filas.

No tiene demasiado sentido pedir a una sentencia SQL que muestre un número variable de valores de columna en las diferentes filas que se solicitan.

Necesitas hacerlo en la misma query por alguna razón?

En respuesta a por Carlos

Carlos, gracias por su respuesta. en realidad si necesito que sea de esa forma.

Actualmente cuando necesito el reporte lo que hago es generar el query y exportarlo a excel para organizarlo cómo me lo pieden.

Me puede ayudar? tiene alguna idea de cómo hacerlo?

 

gracias nuevamente

 

En respuesta a por duvansof

Podrías concatenar los diferentes nombres con espacios ( nombre1 | '  ' | nombre2 ) para que queden en un sólo campo, y utilizar un cursor o una subselect para sacar, de cada familia, todos los nombres de estudiante concatenados por espacios.

Hola... soy nuevo en esto y me dejaron una tarea pero no tengo idea de como hacerla

si me pueden ayudar se lo agradeceria....

Estamos usando un usuario q se llama scott las tablas estan en un archivo que se llama demobldz.sql 

ya hice todas las conecciones, ya tengo las tablas pero nose que comandos utilizar...

estas son las preguntas que tenemos que hacer (estan en ingles)

 

  1. Display the highest, lowest, sum and average salary of all employees. Label the columns Maximum, Minimum, Sum and Average, respectively.  Round your results to the nearest whole number.

  1. Modify the query 1 to display the minimum, maximum, sum and average salary for each job type.

  1. Write a query to display the number of the people with the same job. 

  1. Display the manager number and the salary of the lowest paid employee for that manager. Exclude anyone whose manager is not known. Exclude any groups where minimum salary is 5000 or less.  Sort the output in descending order of salary.

  1. Write a query to display each department’s name, location, number of employees and the average salary for all employees in that department.  Label the columns Name, Location, Number of People, and Salary, respectively. Round the average salary to two decimal places.

  1. Write a query to display the employee name,hire date and sal for all employees in the same department as the employee how not have a manager.  Exclude this employee from the query.

  1. Create a query to display the employee number, name and sal for all employees who earn more than the maximum salary of Clerk job. Sort the results in descending order of salary and complete the salario with $ to 12 characters.

  1. Write a query that will display the employee number, name and department name for all employees who work in a department with any employee whose name contains a ‘S’

  1. Display the employee name, hire date, job and salary of all employees who report to King. 

  1. Display the department name, employee name, job for all employees how work at department locate in CHICAGO.

  1. Display the employee number, name, and salary for all employees who earn more than the average salary and who work in a department with any employee with a T in their name.

  1. Write a query to display the name, department number, and salary of any employee whose department number and salary match the department number and salary of any employee who earns a commission. 

  1. Create a query to display the employees that earn a salary that is higher than the salary of all of the Clerks.  Sort the results on salary from highest to lowest.

De antemano muchas gracias...