CREATE TABLE areas (
  id_area int PRIMARY KEY AUTOINCREMENT,
  nombre varchar(50) not NULL UNIQUE,
  descripcion varchar(100) NULL);
  
CREATE table instructores (
  id_instructor int PRIMARY KEY AUTOINCREMENT,
  nombre varchar(50) not NULL,
  especialidad varchar(50) not NULL,
  salario int CHECK (salario >= 0) not NULL,
  correo varchar(50) unique not NULL,
  id_coordinador int NULL,
  Foreign KEY (id_coordinador) REFERENCES instructores);
  
 CREATE TABLE cursos (
   id_curso int PRIMARY KEY AUTOINCREMENT,
   nombre varchar(50) not NULL,
   creditos int CHECK (creditos >= 0),
   cupo int CHECK(cupo > 0 and cupo <= 40),
   modalidad varchar(20) CHECK MATCH ["Presencial", "Virtual", "Hibrida"] DEFAULT "Presencial",
   precio int check (precio >= 0),
   area int not NULL,
   instructor int NOT NULL,
   FOREIGN key (area) REFERENCES areas,
   FOREIGN key (instructor) REFERENCES instructores);
   
  CREATE table estudiantes (
    id_estudiante int PRIMARY KEY AUTOINCREMENT,
    nombre varchar(50) not NULL,
    ciudad varchar(50) not NULL,
    telefono varchar(15) NULL,
    correo  varchar(50) UNIQUE not NULL,
    fecha_registro date not NULL,
    tipo varchar (10) CHECK MATCH ["Regular", "Becado", "Egresado"] DEFAULT "Regular");
    
  CREATE TABLE inscripciones (
    id_estudiante int,
 	id_curso int, 
    fecha date not NULL,
    nota int check (nota >= 0 and nota <= 5),
    faltas int check( faltas >= 0),
    estado varchar(10) CHECK MATCH ["Activa", "Aprovada", "Reprobada", "Cancelada"] DEFAULT "Activa",
  	PRIMARY key(id_estudiante, id_curso),
    FOREIGN KEY (id_estudiante) REFERENCES estudiantes,
    FOREIGN key (id_curso) REFERENCES cursos);
  

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: