Tabelas : banco de dados
CREATE TABLE alunos(idaluno CHAR(20),nome CHAR(30),login CHAR(20),idade INTEGER,media REAL);
CREATE TABLE alunos(idaluno CHAR(20),nome CHAR(30),cidade CHAR(20));
CREATE TABLE professores(idprofessor CHAR(20),nome CHAR(30),cidade CHAR(20));
CREATE TABLE curso(codCr INTEGER,codDisc INTEGER);
ALTER TABLE disciplina ADD PRIMARY KEY (codDisc);
ALTER TABLE curso ADD PRIMARY KEY (codCr);
CREATE TABLE curriculo(codCr INTEGER,codDisc INTEGER,ObrOpc CHAR(30), CONSTRAINT pk_curriculo PRIMARY KEY (codCr,codDisc), CONSTRAINT fk_curriculo_curso FOREIGN KEY (codCr) REFERENCES CURSO(codCr), CONSTRAINT fk_curriculo_disciplina FOREIGN KEY (codDisc) REFERENCES disciplina(codDisc));
SELECT * FROM alunos;
SELECT * FROM curriculo;
SELECT * FROM disciplina;
INSERT INTO CURSO VALUES (1,101);
INSERT INTO CURSO VALUES (2,102);
INSERT INTO CURSO VALUES (3,103);
INSERT INTO CURSO VALUES (4,104);
SELECT * FROM curso;
INSERT INTO disciplina VALUES (101,'LP I');
INSERT INTO disciplina VALUES (102,'BD II');
INSERT INTO disciplina VALUES (103,'INGLES');
INSERT INTO disciplina VALUES (104,'PORTUGUES');
SELECT * FROM disciplina;
Select dbms_metadata.GET_DDL('TABLE','DISCIPLINA','ALUNO') from DUAL;
Select dbms_metadata.GET_DDL('TABLE','CURSO','ALUNO') from DUAL;
Select dbms_metadata.GET_DDL('TABLE','curriculo','ALUNO') from DUAL;
INSERT INTO curriculo VALUES (1,101,'LINGUAGEM DE PROGRAMAÇAO');
INSERT INTO curriculo VALUES (2,102,'BANCO DE DADOS II');
INSERT INTO curriculo VALUES (3,103,'INGLES');
INSERT INTO curriculo VALUES (4,104,'ESPANHOL');
SELECT * FROM ( SELECT * FROM TURMA ORDER BY CAPACIDADE DESC
) WHERE ROWNUM <=2
CREATE TABLE predio ( CodPr INTEGER PRIMARY KEY, Endereco VARCHAR(80)
);
CREATE SEQUENCE codPr_seq MINVALUE 1 MAXVALUE 999999999