forked from mestanza/MySQL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproced_distinct.sql
66 lines (46 loc) · 1.95 KB
/
proced_distinct.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
create database HomeDepot;
use HomeDepot;
select* from HomeDepot;
delimiter $
create procedure punto_uno(in nomEdo varchar(40))
begin
select Asociado.nombre,Asociado.tel from Asociado,HomeDepot where Asociado.HomeDepot_idHD=HomeDepot.idHD and HomeDepot.estado like nomEdo;
end $
delimiter ;
call punto_uno('DF');
delimiter $
create procedure punto_dos(in nomEdo varchar(40))
begin
select Socio.nombre,Socio.credito,Tarjeta.nombre as Nombre_tarjeta from Socio,Tarjeta,HdSocio,HomeDepot where HomeDepot.idHD=HdSocio.HomeDepot_idHD and HdSocio.Socio_idSocio=Socio.idSocio and Socio.idSocio=Tarjeta.Socio_idSocio and HomeDepot.estado like nomEdo;
end $
delimiter ;
drop procedure punto_dos;
call punto_dos('DF');
select* from Socio;
select*from HomeDepot where nombre like 'Los Mochis';
delimiter $
create procedure punto_tres(in apellido varchar(50))
begin
delete from socio where nombre like concat(apellido,'%');
end $
create procedure punto_cuatro()
begin
select count(Socio.idSocio) as numero_socios from Socio,HdSocio,HomeDepot where HomeDepot.idHD=HdSocio.HomeDepot_idHD and HdSocio.Socio_idSocio=Socio.idSocio and HomeDepot.nombre like 'Los Mochis';
select Socio.nombre from Socio,HdSocio,HomeDepot where HomeDepot.idHD=HdSocio.HomeDepot_idHD and HdSocio.Socio_idSocio=Socio.idSocio and HomeDepot.nombre like 'Los Mochis';
end$
create procedure punto_cinco(in nomHD varchar(60))
begin
select Depto.nombre from Depto,HdDepto,HomeDepot where Depto.idDepto=HdDepto.Depto_idDepto and HdDepto.HomeDepot_idHD=HomeDepot.idHD and HomeDepot.nombre like nomHD;
end $
create procedure punto_seis(in nomTarjeta varchar(50))
begin
select count(socio.idSocio) as Numero_socios from Socio,Tarjeta where Socio.idSocio=Tarjeta.Socio_idSocio and Tarjeta.nombre like nomTarjeta;
end $
delimiter ;
select * from Tarjeta;
select distinct nombre from Tarjeta;
drop procedure punto_seis;
call punto_tres('ARROYO');
call punto_cuatro();
call punto_cinco('Tijuana');
call punto_seis('CREDITO');