ComenzarEmpieza gratis

Simplifying database records

One teacher from the high school heard rumblings about efforts to better organize student records. He would like to organize student grades in his courses. The teacher proposes the following table structure for the test_grades table:

CREATE TABLE test_grades (
    student_id INTEGER NOT NULL,
    course_name VARCHAR(50) NOT NULL,
    grades TEXT NOT NULL
);

Each record represents a student from one of the teacher's classes identified by the student's id, the course name, and the student's test grades. The teacher finds that managing the database with this structure is difficult. Inserting new grades requires a complex query. In addition, doing calculations on the grades is not very easy. In this exercise, you will help to put this table in 1st Normal Form (1NF).

Este ejercicio forma parte del curso

Creating PostgreSQL Databases

Ver curso

Instrucciones del ejercicio

  • Define a new version of the table with the name test_grade.
  • Include student_id and course_name columns as defined in the test_grades table.
  • In place of a grades column, include a numeric column named grade.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

-- Create the test_grade table
___ ___ ___ (
    -- Include a column for the student id
	___ ___ NOT NULL,
  
  	-- Include a column for the course name
    ___ ___ NOT NULL,
  
  	-- Add a column to capture a single test grade
    ___ ___ NOT NULL
);
Editar y ejecutar código