Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
NOM_PER
varchar(40)
not null,
APE_PAT_PER
varchar(15)
not null,
APE_MAT_PER
varchar(15)
not null,
E_MAIL
varchar(40)
not null,
ESTATUS_PER
bit
not null,
FECHA_NAC
date
null,
constraint PK_PERSONAS primary key clustered (NO_CONTROL)
);
/*==============================================================*/
/* Table: PERTENECE
*/
/*==============================================================*/
drop table if exists PERTENECE;
create table PERTENECE
(
ID_CANCION
integer
not null,
ID_LISTA
integer
not null,
ORDEN
tinyint
null,
constraint PK_PERTENECE primary key clustered (ID_CANCION, ID_LISTA)
);
/*==============================================================*/
/* Table: USUARIOS
*/
/*==============================================================*/
drop table if exists USUARIOS;
create table USUARIOS
(
ID_USU
smallint
not null,
NOM_USU
varchar(15)
not null,
PASSWORD
varchar(40)
not null,
ESTATUS_USU
bit
not null,
constraint PK_USUARIOS primary key clustered (ID_USU)
);
set autocommit=0;
/*==============================================================*/
/* INSERTAR EN TABLA USUARIOS
*/
insert into USUARIOS(ID_USU,NOM_USU,PASSWORD,ESTATUS_USU)
values (1,
'usu1',
'abc123',
1),
(2,
'usu2',
'bcd123',
(3,
'usu3',
'cde123',
(4,
'usu4',
'def123',
(5,
'usu5',
'efg123',
(6,
'usu6',
'fgh123',
(7,
'usu7',
'ghi123',
(8,
'usu8',
'hij123',
(9,
'usu9',
'ijk123',
(10,
'usu10',
'jkl123',
1);
commit;
0),
1),
0),
1),
1),
1),
1),
0),
/*==============================================================*/
/* INSERTAR EN TABLA PERSONAS
*/
insert into PERSONAS (NO_CONTROL,NOM_PER,APE_PAT_PER,APE_MAT_PER,E_MAIL,FECHA_NA
C,ESTATUS_PER)
values (11590111,
'anayeli',
'otero',
'ugalde',
'ana@gmail.com',
0,
0),
(11590112,
'berenice',
s',
'chavez',
'bere@gmail.com',
(11590113,
'cristina',
ez',
'aguilar',
'cristina@gmail.com', 0,1),
(11590114,
'antonio',
'palacio',
'antonio@gmail.com',
0,0),
(11590115,
'guadalupe',
'bravo',
'lupe@gmail.com',
0,1),
(11590116,
'ricardo',
,
'ramirez',
'ricardo@gmail.com',
(11590117,
'jose',
',
'ortega',
'molina@gmail.com',
(11590118,
'patricia',
'salazar',
'patricia@gmail.com', 0,1),
(11590119,
'antonio',
ez',
'hernandez',
'antonio@gmail.com',
0,1),
(11590110,
'Razziel',
',
'Pea',
'razziel@gmail.com',
commit;
'barcena
0,1),
'hernand
'ruiz',
'moreno',
'molina'
0,1),
'jimenez
0,0),
'lopez',
'hernand
'Vidales
0,1);
/*==============================================================*/
/* INSERTAR EN TABLA CANCIONES
*/
insert into CANCIONES (ID_CANCION,NOM_CANCION,GENERO,AUTOR,DURACION,FECHA,ESTATU
S_CANCION)
values (1,
'dont worry be happy',
'pop',
'BOBBY MCFERRIN',
000315, 20111002,
1),
(2,
'Seen The Rain',
'pop',
'Creedence',
000237, 19981003,
1),
(3,
'Lovers On The Sun',
'house',
'David Guetta',
000323, 20140802,
1),
(4,
'Shot Me Down',
'house',
'David Guetta',
000310, 20140802,
1),
(5,
'Bad',
'house',
'David Guetta',
000250, 20140802,
1),
(6,
'Pan y Mantequilla',
'pop',
'Efecto pasillo',
000323, 20101017,
1),
(7,
'Que Sera de mi vida',
'pop',
'Gibson brothers',
000353, 19820308,
1),
(8,
'Instant Crush',
'house',
'Daft punk',
000535, 20140711,
1),
(9,
'Animals',
'electro',
'Martin Garrix',
000311, 20140525,
1),
(10,
'Youre The One That I Want',
'rock po
p',
'Grease',
000310, 19810112,
1);
commit;
/*==============================================================*/
/* INSERTAR EN TABLA LISTA_REPRODUCCION
*/
*/
*/
*/
commit;
/*==============================================================*/
/* INSERTAR EN TABLA PERTENECE
*/
*/
PERSONAS;
USUARIOS;
LISTA_REPRODUCCION;
CANCIONES;
CREA_USU;
CREA;
BAJA;
PERTENECE;
/*==============================================================*/
/* Consulta
*/
select nom_per, ape_pat_per, ape_mat_per
from personas, crea_usu, crea, lista_reproduccion
where personas.no_control=crea_usu.no_Control and crea_usu.id_usu=crea.id_usu
and crea.id_lista=lista_reproduccion.id_lista
group by nom_per
having (
select count(baja.id_cancion)
from canciones, baja, pertenece
where canciones.id_cancion=baja.id_cancion and baja.id_cancion=pertenece.id_canc
ion)>2;
/*==============================================================*/
/* Privilegios
*/
Grant insert,delete
Grant insert,delete,update
on PERSONAS to 'usu_n1';
on USUARIOS to 'usu_n1';
Grant
Grant
Grant
Grant
Grant
Grant
select,insert,delete,update
select,insert,delete
insert
insert
insert
select,insert,update
on LISTA_REPRODUCCION to 'usu_n1';
on CANCIONES to 'usu_n1';
on CREA_USU to 'usu_n1';
on CREA to 'usu_n1';
on BAJA to 'usu_n1';
on PERTENECE to 'usu_n1';
Grant
Grant
Grant
Grant
Grant
Grant
Grant
Grant
select,insert,delete
select,insert,update
select,insert,delete,update
select,insert,delete
select,insert
select,insert
select,insert
select,insert,update
on PERSONAS to 'usu_n2';
on USUARIOS to 'usu_n2';
on LISTA_REPRODUCCION to 'usu_n2';
on CANCIONES to 'usu_n2';
on CREA_USU to 'usu_n2';
on CREA to 'usu_n2';
on BAJA to 'usu_n2';
on PERTENECE to 'usu_n2';
Grant
Grant
Grant
Grant
Grant
Grant
Grant
Grant
ALL
ALL
ALL
ALL
ALL
ALL
ALL
ALL
on
on
on
on
on
on
on
on
PERSONAS to 'usu_n3';
USUARIOS to 'usu_n3';
LISTA_REPRODUCCION to 'usu_n3';
CANCIONES to 'usu_n3';
CREA_USU to 'usu_n3';
CREA to 'usu_n3';
BAJA to 'usu_n3';
PERTENECE to 'usu_n3';