0% found this document useful (0 votes)
195 views4 pages

1) DDL

The document contains SQL statements that create 7 tables, apply primary keys to each table, and define 13 foreign key constraints between the tables. The tables define an entity relationship model for a student enrollment and billing system with tables for students, courses, enrollments, payments, and balances.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
195 views4 pages

1) DDL

The document contains SQL statements that create 7 tables, apply primary keys to each table, and define 13 foreign key constraints between the tables. The tables define an entity relationship model for a student enrollment and billing system with tables for students, courses, enrollments, payments, and balances.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

-- Generado por Oracle SQL Developer Data Modeler 21.4.1.349.

1605
-- en: 2022-10-20 18:59:02 CST
-- sitio: SQL Server 2012
-- tipo: SQL Server 2012

CREATE TABLE abonos


(
id INTEGER NOT NULL ,
fecha DATE ,
banco NVARCHAR (150) ,
boleta INTEGER ,
monto FLOAT ,
matricula_ID INTEGER NOT NULL
)
GO

ALTER TABLE abonos ADD CONSTRAINT abonos_PK PRIMARY KEY CLUSTERED (id)
WITH (
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON )
GO

CREATE TABLE alumno


(
carne NVARCHAR (20) NOT NULL ,
nombres NVARCHAR (150) NOT NULL ,
apellidos NVARCHAR (150) NOT NULL
)
GO

ALTER TABLE alumno ADD CONSTRAINT alumno_PK PRIMARY KEY CLUSTERED (carne)
WITH (
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON )
GO

CREATE TABLE carrera


(
id_carrera INTEGER NOT NULL ,
carrera NVARCHAR (100)
)
GO

ALTER TABLE carrera ADD CONSTRAINT carrera_PK PRIMARY KEY CLUSTERED (id_carrera)
WITH (
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON )
GO

CREATE TABLE cuentaxcobrar


(
id INTEGER NOT NULL ,
saldo FLOAT ,
matricula_ID INTEGER NOT NULL
)
GO
ALTER TABLE cuentaxcobrar ADD CONSTRAINT cuentaxcobrar_PK PRIMARY KEY CLUSTERED
(id)
WITH (
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON )
GO

CREATE TABLE matricula


(
ID INTEGER NOT NULL ,
Mensualidad FLOAT ,
planes_id_plan INTEGER NOT NULL ,
semestre_id_semestre INTEGER NOT NULL ,
carrera_id_carrera INTEGER NOT NULL ,
alumno_carne NVARCHAR (20) NOT NULL
)
GO

ALTER TABLE matricula ADD CONSTRAINT Matricula_PK PRIMARY KEY CLUSTERED (ID)
WITH (
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON )
GO

CREATE TABLE planes


(
id_plan INTEGER NOT NULL ,
planes NVARCHAR (100)
)
GO

ALTER TABLE planes ADD CONSTRAINT planes_PK PRIMARY KEY CLUSTERED (id_plan)
WITH (
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON )
GO

CREATE TABLE semestre


(
id_semestre INTEGER NOT NULL ,
semestre NVARCHAR (100)
)
GO

ALTER TABLE semestre ADD CONSTRAINT semestre_PK PRIMARY KEY CLUSTERED (id_semestre)
WITH (
ALLOW_PAGE_LOCKS = ON ,
ALLOW_ROW_LOCKS = ON )
GO

ALTER TABLE abonos


ADD CONSTRAINT abonos_matricula_FK FOREIGN KEY
(
matricula_ID
)
REFERENCES matricula
(
ID
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO

ALTER TABLE cuentaxcobrar


ADD CONSTRAINT cuentaxcobrar_matricula_FK FOREIGN KEY
(
matricula_ID
)
REFERENCES matricula
(
ID
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO

ALTER TABLE matricula


ADD CONSTRAINT matricula_alumno_FK FOREIGN KEY
(
alumno_carne
)
REFERENCES alumno
(
carne
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO

ALTER TABLE matricula


ADD CONSTRAINT matricula_carrera_FK FOREIGN KEY
(
carrera_id_carrera
)
REFERENCES carrera
(
id_carrera
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO

ALTER TABLE matricula


ADD CONSTRAINT matricula_planes_FK FOREIGN KEY
(
planes_id_plan
)
REFERENCES planes
(
id_plan
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO

ALTER TABLE matricula


ADD CONSTRAINT matricula_semestre_FK FOREIGN KEY
(
semestre_id_semestre
)
REFERENCES semestre
(
id_semestre
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
GO

-- Informe de Resumen de Oracle SQL Developer Data Modeler:


--
-- CREATE TABLE 7
-- CREATE INDEX 0
-- ALTER TABLE 13
-- CREATE VIEW 0
-- ALTER VIEW 0
-- CREATE PACKAGE 0
-- CREATE PACKAGE BODY 0
-- CREATE PROCEDURE 0
-- CREATE FUNCTION 0
-- CREATE TRIGGER 0
-- ALTER TRIGGER 0
-- CREATE DATABASE 0
-- CREATE DEFAULT 0
-- CREATE INDEX ON VIEW 0
-- CREATE ROLLBACK SEGMENT 0
-- CREATE ROLE 0
-- CREATE RULE 0
-- CREATE SCHEMA 0
-- CREATE SEQUENCE 0
-- CREATE PARTITION FUNCTION 0
-- CREATE PARTITION SCHEME 0
--
-- DROP DATABASE 0
--
-- ERRORS 0
-- WARNINGS 0

You might also like