martes, 19 de mayo de 2020
Conexion.---
class Conexion{
public function conectar(){
$bd="evaluacion";
$host="mysql:host=localhost;dbname=".$bd;
$usuario="root";
$password="";
$link = new PDO($host,$usuario,$password, array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
return $link;
}
}
-----------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------
public function nombrefuncion($param){
$mensaje="";
try {
$conexion=Conexion::conectar();
$sql="INSERT INTO tabla(campo)
VALUES (:param);";
$stmt = $conexion->prepare($sql);
$stmt->bindParam(":param", $param);
$stmt->execute();
$fila=$stmt->rowCount();
$mensaje="Guardo, Proyecto";
} catch(PDOException $e) {
if ($e->errorInfo[1] == 1062) {
$mensaje="registro duplicado";
// duplicate entry, do something else
} else {
// an error other than duplicate entry occurred
echo $e->errorInfo[1];
}
}
return $mensaje;
}
---------------------------------------------------------------
public function listaProyecto(){
$stmt = Conexion::conectar()->prepare("query");
$stmt->execute();
#fetchAll(): Obtiene todas las filas de un conjunto de resultados asociado al objeto PDOStatement.
$array=$stmt->fetchAll(PDO::FETCH_ASSOC);
// cerrar conexion;
$stmt=null;
return $array;
}
---------------------------------------------------------------------------------------------------------
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: X-API-KEY, ,Authorization,Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Allow: GET, POST, OPTIONS, PUT, DELETE");
header('Content-Type: application/json;charset=utf-8');
http_response_code('202');
viernes, 17 de abril de 2020
martes, 14 de abril de 2020
selector buttonnavigationview
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/boton_seleccion" android:state_checked="true" />
<item android:color="@color/boton_normal_default" />
</selector>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/boton_seleccion" android:state_checked="true" />
<item android:color="@color/boton_normal_default" />
</selector>
martes, 24 de marzo de 2020
Notificación Android
public class MainActivity extends AppCompatActivity { private static final String CHANNEL_ID = "notificacion"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Intent intent = new Intent(this, AlertActivity.class);//intent para ir a un sitio web//// Intent intent = new Intent(Intent.ACTION_VIEW);
// intent.setData(Uri.parse("http://usbcartagena.edu.co/"));// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);//PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,intent, 0);NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID) .setSmallIcon(R.drawable.ic_announcement_black_24dp) .setContentTitle("Notificación Sanbuenaventura") .setContentText("Clases Virtual por Covid 19") .setPriority(NotificationCompat.PRIORITY_DEFAULT)// .setContentIntent(pendingIntent).setAutoCancel(true); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);int notificationId=100; notificationManager.notify(notificationId, builder.build()); }LogoUsbARCHIVO PAGINA WEB RESPONSIVO PRACTICA WEBVIEWpagina web responsivaImagenes AndroidAplicación Javascript responsivo
lunes, 23 de marzo de 2020
jueves, 12 de marzo de 2020
Clase 3 Funciones
Script Ejemplo de Funciones
--Inner Join
select * from dbo.cargo
inner join dbo.empleado
on cargo.codcargo=empleado.codcargo;
--Vista de Join
create view dbo.vistaemp as
select departamento.coddep,nomdep,cargo.codcargo,
nomcargo,salario,codemp,
primnom||' '||primapel as primapel,edad
from dbo.departamento
inner join (dbo.cargo inner join dbo.empleado
on cargo.codcargo=empleado.codcargo)
on departamento.coddep=cargo.coddep;
select * from dbo.vistaemp;
update dbo.empleado
set codcargo='101-2',
segnom='jose'
where codemp='73121295';
---update
update dbo.departamento
set numcargo=numcargo+1
where coddep='101';
--Rutina Funcion Ejercicio 1
create or replace function
dbo.sumavoid(n integer,m integer)
returns void as $$
declare suma integer;
begin
suma:= n+m;
RAISE NOTICE 'suma=%',suma;
end
$$ language plpgsql;
select dbo.sumavoid(4,5);
Rutina Ejercicio 1 V2
create or replace function
dbo.sumavoidv2(n integer,m integer)
returns void as $$
declare suma integer;
begin
suma:= n+m;
RAISE NOTICE '%+%=%',n,m,suma;
end
$$ language plpgsql;
select dbo.sumavoidv2(4,5);
Rutina Ejericicio 2
create or replace
function dbo.areacirculo(radio double precision)
returns void as $$
declare
area double precision;
PI double precision;
begin
PI=3.1416;
area:= PI*(radio ^ 2);
RAISE NOTICE 'area circulo=%',area;
end
$$ language plpgsql;
select dbo.areacirculo(34.65);
rutina iva
CREATE OR REPLACE FUNCTION dbo.calculoivav1(compra double precision)
RETURNS void AS $$
declare
iva double precision;
comprasal character(30);
ivasal character(30);
horasal character(30);
fecha date;
hora time;
begin
iva:=compra*0.19;
fecha=now();
hora=now();
comprasal:=to_char(compra,'LFM9,999,999,999,999.00');
ivasal:=to_char(iva,'LFM9,999,999,999,999.00');
horasal=to_char(now()::Time, 'HH12:MI:SS AM');
RAISE NOTICE 'ecompra %',comprasal;
RAISE NOTICE 'iva % ',ivasal;
RAISE NOTICE 'fecha %',fecha;
RAISE NOTICE 'hora %',horasal;
END;
$$ language plpgsql;
select dbo.calculoivav1(45000000);
funcion iva v2
CREATE OR REPLACE FUNCTION dbo.calculoivav2(compra double precision)
RETURNS void AS $$
declare
iva double precision;
comprasal character(30);
ivasal character(30);
horasal character(30);
total double precision;
totalsal character(30);
fecha date;
hora time;
begin
iva:=compra*0.19;
total:=compra+iva;
fecha=now();
hora=now();
comprasal:=to_char(compra,'LFM9,999,999,999,999.00');
ivasal:=to_char(iva,'LFM9,999,999,999,999.00');
totalsal:=to_char(total,'LFM9,999,999,999,999.00');
horasal=to_char(now()::Time, 'HH12:MI:SS AM');
RAISE NOTICE 'ecompra %',comprasal;
RAISE NOTICE 'iva % ',ivasal;
RAISE NOTICE '--------------';
RAISE NOTICE 'Total:%',totalsal;
RAISE NOTICE 'fecha %',fecha;
RAISE NOTICE 'hora %',horasal;
END;
$$ language plpgsql;
select dbo.calculoivav1(45000000);
--if en funciones
create or replace function dbo.validaredad(edad integer)
returns void as $$
begin
IF(edad>=18) then
RAISE NOTICE 'MAYOR DE EDAD';
ELSE
RAISE NOTICE 'MENOR DE EDAD';
END IF;
END
$$ language plpgsql;
funcion edad v2
create or replace function dbo.validaredadv2(edad integer)
returns character(20) as $$
begin
IF(edad>=18) then
return 'MAYOR DE EDAD';
ELSE
return 'MENOR DE EDAD';
END IF;
END
$$ language plpgsql;
select dbo.validaredadv2(19);
Lados triangulo
create or replace function
dbo.tipotriangulo(l1 double precision,
l2 double precision,l3 double precision)
returns void as $$
begin
IF((l1=l2) and (l2=l3) and (l1=l3)) then
RAISE NOTICE 'Triangulo Equilatero';
ELSEIF ((l1<>l2) and (l2<>l3) and (l1<>l3)) then
RAISE NOTICE 'Triangulo Escaleno';
ELSE
RAISE NOTICE 'Triangulo Isosceles';
END IF;
END;
$$ language plpgsql;
select dbo.tipotriangulo(34.5,34.5,34.5);
funcion mostrar numero de cargos por departamentos
CREATE OR REPLACE FUNCTION dbo.reporte(
coddepe character,
nomdepe character)
RETURNS character AS $$
declare
cont integer;
begin
cont:=(select count(codcargo) from dbo.cargo where coddep=coddepe);
RAISE NOTICE '*****************************';
RAISE NOTICE '****Codigo Departamento %',coddepe;
RAISE NOTICE '****Nombre Departamento %',nomdepe;
RAISE NOTICE 'Numero Cargo: %',cont;
RAISE NOTICE '*****************************';
return 'Codigo Departamento: '||coddepe|| ' Nombre Departamento: '||nomdepe||' Total: '||cont;
end;
$$ LANGUAGE plpgsql;
select dbo.reporte(coddep,nomdep) from dbo.departamento;
funcion crear empleado
create or replace function dbo.crearempleado(
codemp character(10),
primnom character(20),segnom character(20),
primapel character(20),segapel character(20),
codcargo character(10),edad integer)
returns integer as $$
begin
insert into dbo.empleado values(codemp,primnom,segnom,
primapel,segapel,codcargo,edad);
return 1;
exception
when unique_violation then
return 0;
when foreign_key_violation then
return -1;
end;
$$ language plpgsql;
--Inner Join
select * from dbo.cargo
inner join dbo.empleado
on cargo.codcargo=empleado.codcargo;
--Vista de Join
create view dbo.vistaemp as
select departamento.coddep,nomdep,cargo.codcargo,
nomcargo,salario,codemp,
primnom||' '||primapel as primapel,edad
from dbo.departamento
inner join (dbo.cargo inner join dbo.empleado
on cargo.codcargo=empleado.codcargo)
on departamento.coddep=cargo.coddep;
select * from dbo.vistaemp;
update dbo.empleado
set codcargo='101-2',
segnom='jose'
where codemp='73121295';
---update
update dbo.departamento
set numcargo=numcargo+1
where coddep='101';
--Rutina Funcion Ejercicio 1
create or replace function
dbo.sumavoid(n integer,m integer)
returns void as $$
declare suma integer;
begin
suma:= n+m;
RAISE NOTICE 'suma=%',suma;
end
$$ language plpgsql;
select dbo.sumavoid(4,5);
Rutina Ejercicio 1 V2
create or replace function
dbo.sumavoidv2(n integer,m integer)
returns void as $$
declare suma integer;
begin
suma:= n+m;
RAISE NOTICE '%+%=%',n,m,suma;
end
$$ language plpgsql;
select dbo.sumavoidv2(4,5);
Rutina Ejericicio 2
create or replace
function dbo.areacirculo(radio double precision)
returns void as $$
declare
area double precision;
PI double precision;
begin
PI=3.1416;
area:= PI*(radio ^ 2);
RAISE NOTICE 'area circulo=%',area;
end
$$ language plpgsql;
select dbo.areacirculo(34.65);
rutina iva
CREATE OR REPLACE FUNCTION dbo.calculoivav1(compra double precision)
RETURNS void AS $$
declare
iva double precision;
comprasal character(30);
ivasal character(30);
horasal character(30);
fecha date;
hora time;
begin
iva:=compra*0.19;
fecha=now();
hora=now();
comprasal:=to_char(compra,'LFM9,999,999,999,999.00');
ivasal:=to_char(iva,'LFM9,999,999,999,999.00');
horasal=to_char(now()::Time, 'HH12:MI:SS AM');
RAISE NOTICE 'ecompra %',comprasal;
RAISE NOTICE 'iva % ',ivasal;
RAISE NOTICE 'fecha %',fecha;
RAISE NOTICE 'hora %',horasal;
END;
$$ language plpgsql;
select dbo.calculoivav1(45000000);
funcion iva v2
CREATE OR REPLACE FUNCTION dbo.calculoivav2(compra double precision)
RETURNS void AS $$
declare
iva double precision;
comprasal character(30);
ivasal character(30);
horasal character(30);
total double precision;
totalsal character(30);
fecha date;
hora time;
begin
iva:=compra*0.19;
total:=compra+iva;
fecha=now();
hora=now();
comprasal:=to_char(compra,'LFM9,999,999,999,999.00');
ivasal:=to_char(iva,'LFM9,999,999,999,999.00');
totalsal:=to_char(total,'LFM9,999,999,999,999.00');
horasal=to_char(now()::Time, 'HH12:MI:SS AM');
RAISE NOTICE 'ecompra %',comprasal;
RAISE NOTICE 'iva % ',ivasal;
RAISE NOTICE '--------------';
RAISE NOTICE 'Total:%',totalsal;
RAISE NOTICE 'fecha %',fecha;
RAISE NOTICE 'hora %',horasal;
END;
$$ language plpgsql;
select dbo.calculoivav1(45000000);
--if en funciones
create or replace function dbo.validaredad(edad integer)
returns void as $$
begin
IF(edad>=18) then
RAISE NOTICE 'MAYOR DE EDAD';
ELSE
RAISE NOTICE 'MENOR DE EDAD';
END IF;
END
$$ language plpgsql;
funcion edad v2
create or replace function dbo.validaredadv2(edad integer)
returns character(20) as $$
begin
IF(edad>=18) then
return 'MAYOR DE EDAD';
ELSE
return 'MENOR DE EDAD';
END IF;
END
$$ language plpgsql;
select dbo.validaredadv2(19);
Lados triangulo
create or replace function
dbo.tipotriangulo(l1 double precision,
l2 double precision,l3 double precision)
returns void as $$
begin
IF((l1=l2) and (l2=l3) and (l1=l3)) then
RAISE NOTICE 'Triangulo Equilatero';
ELSEIF ((l1<>l2) and (l2<>l3) and (l1<>l3)) then
RAISE NOTICE 'Triangulo Escaleno';
ELSE
RAISE NOTICE 'Triangulo Isosceles';
END IF;
END;
$$ language plpgsql;
select dbo.tipotriangulo(34.5,34.5,34.5);
funcion mostrar numero de cargos por departamentos
CREATE OR REPLACE FUNCTION dbo.reporte(
coddepe character,
nomdepe character)
RETURNS character AS $$
declare
cont integer;
begin
cont:=(select count(codcargo) from dbo.cargo where coddep=coddepe);
RAISE NOTICE '*****************************';
RAISE NOTICE '****Codigo Departamento %',coddepe;
RAISE NOTICE '****Nombre Departamento %',nomdepe;
RAISE NOTICE 'Numero Cargo: %',cont;
RAISE NOTICE '*****************************';
return 'Codigo Departamento: '||coddepe|| ' Nombre Departamento: '||nomdepe||' Total: '||cont;
end;
$$ LANGUAGE plpgsql;
select dbo.reporte(coddep,nomdep) from dbo.departamento;
funcion crear empleado
create or replace function dbo.crearempleado(
codemp character(10),
primnom character(20),segnom character(20),
primapel character(20),segapel character(20),
codcargo character(10),edad integer)
returns integer as $$
begin
insert into dbo.empleado values(codemp,primnom,segnom,
primapel,segapel,codcargo,edad);
return 1;
exception
when unique_violation then
return 0;
when foreign_key_violation then
return -1;
end;
$$ language plpgsql;
miércoles, 11 de marzo de 2020
Clase 2 SQL
Modelo Relacional
--Tabla departamento
CREATE TABLE dbo.departamento
(
coddep character(10) NOT NULL,
nomdep character(50) NOT NULL,
CONSTRAINT pk_departamento PRIMARY KEY (coddep)
);
-- Tabla Cargo
CREATE TABLE dbo.cargo
(
codcargo character(10) NOT NULL,
nomcargo character(100) NOT NULL,
salario integer,
coddep character(10),
CONSTRAINT pk_cargo PRIMARY KEY (codcargo),
CONSTRAINT fk_cargo FOREIGN KEY (coddep)
REFERENCES dbo.departamento (coddep) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
);
--Tabla Empleado
CREATE TABLE dbo.empleado
(
codemp character(10) NOT NULL,
primnom character(20),
segnom character(20),
primapel character(20),
segapel character(20),
codcargo character(10),
edad integer,
CONSTRAINT pk_empleado PRIMARY KEY (codemp),
CONSTRAINT fk_empleado FOREIGN KEY (codcargo)
REFERENCES dbo.cargo (codcargo) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
Practica Script Clase
practica clase
Seleccion de la tabla departamento y cargo
select * from dbo.departamento as d,dbo.cargo as c
where d.coddep=c.coddep;
Cuenta el total de cargos
select count(d.coddep) as total
from dbo.departamento as d,dbo.cargo as c
where d.coddep=c.coddep;
Having y Group By
select d.coddep,nomdep,count(d.coddep) as total
from dbo.departamento as d,dbo.cargo as c
where d.coddep=c.coddep
group by d.coddep,nomdep
having count(d.coddep)>2;
Having y Group By
select d.coddep,nomdep,min(salario) as promedio
from dbo.departamento as d,dbo.cargo as c
where d.coddep=c.coddep
group by d.coddep,nomdep
Having y Group BY
select c.codcargo,nomcargo,count(codemp) as total
from dbo.cargo as c,dbo.empleado as e
where c.codcargo=e.codcargo
group by c.codcargo,nomcargo;
vista
create view dbo.vistaest as
select c.codcargo,nomcargo,count(codemp) as total
from dbo.cargo as c,dbo.empleado as e
where c.codcargo=e.codcargo
group by c.codcargo,nomcargo;
select nomcargo,total from dbo.vistaest;
Subconsulta
SELECT * from dbo.empleado
WHERE edad >(SELECT avg(edad)
FROM dbo.empleado);
Any
select * from dbo.cargo
where codcargo=any (select codcargo
from dbo.empleado where edad>30);
All
select * from dbo.cargo
where codcargo=all (select codcargo
from dbo.empleado where edad>30);
Tabla Copia Sexo
CREATE TABLE dbo.sexocop
(
idsexo serial NOT NULL,
nomsexo character(20),
CONSTRAINT pk_sexoc PRIMARY KEY (idsexo)
)
insertar filas a traves de select
insert into dbo.sexo2(idsexo,nomsexo)
select idsexo,nomsexo from dbo.sexo;
--Tabla departamento
CREATE TABLE dbo.departamento
(
coddep character(10) NOT NULL,
nomdep character(50) NOT NULL,
CONSTRAINT pk_departamento PRIMARY KEY (coddep)
);
-- Tabla Cargo
CREATE TABLE dbo.cargo
(
codcargo character(10) NOT NULL,
nomcargo character(100) NOT NULL,
salario integer,
coddep character(10),
CONSTRAINT pk_cargo PRIMARY KEY (codcargo),
CONSTRAINT fk_cargo FOREIGN KEY (coddep)
REFERENCES dbo.departamento (coddep) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
);
--Tabla Empleado
CREATE TABLE dbo.empleado
(
codemp character(10) NOT NULL,
primnom character(20),
segnom character(20),
primapel character(20),
segapel character(20),
codcargo character(10),
edad integer,
CONSTRAINT pk_empleado PRIMARY KEY (codemp),
CONSTRAINT fk_empleado FOREIGN KEY (codcargo)
REFERENCES dbo.cargo (codcargo) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
Practica Script Clase
practica clase
Seleccion de la tabla departamento y cargo
select * from dbo.departamento as d,dbo.cargo as c
where d.coddep=c.coddep;
Cuenta el total de cargos
select count(d.coddep) as total
from dbo.departamento as d,dbo.cargo as c
where d.coddep=c.coddep;
Having y Group By
select d.coddep,nomdep,count(d.coddep) as total
from dbo.departamento as d,dbo.cargo as c
where d.coddep=c.coddep
group by d.coddep,nomdep
having count(d.coddep)>2;
Having y Group By
select d.coddep,nomdep,min(salario) as promedio
from dbo.departamento as d,dbo.cargo as c
where d.coddep=c.coddep
group by d.coddep,nomdep
Having y Group BY
select c.codcargo,nomcargo,count(codemp) as total
from dbo.cargo as c,dbo.empleado as e
where c.codcargo=e.codcargo
group by c.codcargo,nomcargo;
vista
create view dbo.vistaest as
select c.codcargo,nomcargo,count(codemp) as total
from dbo.cargo as c,dbo.empleado as e
where c.codcargo=e.codcargo
group by c.codcargo,nomcargo;
select nomcargo,total from dbo.vistaest;
Subconsulta
SELECT * from dbo.empleado
WHERE edad >(SELECT avg(edad)
FROM dbo.empleado);
Any
select * from dbo.cargo
where codcargo=any (select codcargo
from dbo.empleado where edad>30);
All
select * from dbo.cargo
where codcargo=all (select codcargo
from dbo.empleado where edad>30);
Tabla Copia Sexo
CREATE TABLE dbo.sexocop
(
idsexo serial NOT NULL,
nomsexo character(20),
CONSTRAINT pk_sexoc PRIMARY KEY (idsexo)
)
insertar filas a traves de select
insert into dbo.sexo2(idsexo,nomsexo)
select idsexo,nomsexo from dbo.sexo;
martes, 10 de marzo de 2020
Clase 1 SQL
MODELO RELACIONAL
--Tabla Sexo
CREATE TABLE dbo.sexo
(
idsexo serial NOT NULL,
nomsexo character(20),
CONSTRAINT pk_sexo PRIMARY KEY (idsexo)
);
--Tabla Persona
CREATE TABLE dbo.persona
(
codigo character(10) NOT NULL ,
primnom character(20)NOT NULL,
segnom character(20),
primapel character(20) NOT NULL,
segapel character(20) NOT NULL,
sexo bigint NOT NULL,
edad integer NOT NULL,
CONSTRAINT pk_persona PRIMARY KEY (codigo),
CONSTRAINT fk_persona FOREIGN KEY (sexo)
REFERENCES dbo.sexo (idsexo) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
--Datos Tabla Sexo
insert into dbo.sexo(nomsexo)
values('Masculino');
insert into dbo.sexo(nomsexo)
values('Femenino');
--Datos Tabla Persona
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1001','carlos','jose','caceres','ochoa',1,40);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1002','manuel','','perez','gomez',1,32);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1003','maria','jose','velez','lopez',2,20);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1004','juan','jose','rodriguez','ramos',1,50);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1005','antonio','','moreno','diaz',1,18);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1006','victoria','','saenz','morelos',2,24);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1007','carlos','julio','romero','paternina',2,24);
Script Sql
distinct
select distinct primnom from dbo.persona;
where
select * from dbo.persona where primnom='carlos';
select * from dbo.persona where primnom='carlos' and edad>30;
select * from dbo.persona where primnom='carlos' or edad>30;
select * from dbo.persona where primnom='carlos' and not edad>30;
select * from dbo.persona order by primapel desc;
contengan i
select * from dbo.persona where primnom like '%i%';
contengan ria
select * from dbo.persona where primnom like '%ria%';
comienze con a
select * from dbo.persona where primnom like 'a%';
comienzen con m
select * from dbo.persona where primnom like 'm%';
comienzen ma
select * from dbo.persona where primnom like 'ma_%';
comienzan ar
select * from dbo.persona where primnom like '_ar%';
select * from dbo.persona where segapel like '__m_%';
concatenar
select primnom||' '||primapel as nomapel from dbo.persona;
select upper(primnom||' '||primapel ) as nomapel from dbo.persona;
select lower(primnom||' '||primapel ) as nomapel from dbo.persona;
select count(codigo) from dbo.persona;
select max(edad) from dbo.persona;
select min(edad) from dbo.persona;
select avg(edad) from dbo.persona;
select max(edad) as edades from dbo.persona
union
select min(edad) from dbo.persona;
between
select * from
dbo.persona
where codigo
between '1001' and '1003';
select * from
dbo.persona
where codigo
between '1001' and '1003';
IN
SELECT * FROM dbo.persona
WHERE primnom IN ('carlos', 'manuel');
NOT IN
SELECT * FROM dbo.persona
WHERE primnom NOT IN ('carlos', 'manuel');
alias estructura
select p.codigo,p.primnom,p.primapel,p.edad,p.sexo from dbo.persona as p,dbo.sexo as s
where p.sexo=s.idsexo and p.sexo=1;
VALUES ('1003','maria','jose','velez','lopez',2,20);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1004','juan','jose','rodriguez','ramos',1,50);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1005','antonio','','moreno','diaz',1,18);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1006','victoria','','saenz','morelos',2,24);
INSERT INTO dbo.persona(codigo, primnom, segnom, primapel, segapel, sexo, edad)
VALUES ('1007','carlos','julio','romero','paternina',2,24);
Script Sql
distinct
select distinct primnom from dbo.persona;
where
select * from dbo.persona where primnom='carlos';
select * from dbo.persona where primnom='carlos' and edad>30;
select * from dbo.persona where primnom='carlos' or edad>30;
select * from dbo.persona where primnom='carlos' and not edad>30;
select * from dbo.persona order by primapel desc;
contengan i
select * from dbo.persona where primnom like '%i%';
contengan ria
select * from dbo.persona where primnom like '%ria%';
comienze con a
select * from dbo.persona where primnom like 'a%';
comienzen con m
select * from dbo.persona where primnom like 'm%';
comienzen ma
select * from dbo.persona where primnom like 'ma_%';
comienzan ar
select * from dbo.persona where primnom like '_ar%';
select * from dbo.persona where segapel like '__m_%';
concatenar
select primnom||' '||primapel as nomapel from dbo.persona;
select upper(primnom||' '||primapel ) as nomapel from dbo.persona;
select lower(primnom||' '||primapel ) as nomapel from dbo.persona;
select count(codigo) from dbo.persona;
select max(edad) from dbo.persona;
select min(edad) from dbo.persona;
select avg(edad) from dbo.persona;
select max(edad) as edades from dbo.persona
union
select min(edad) from dbo.persona;
between
select * from
dbo.persona
where codigo
between '1001' and '1003';
select * from
dbo.persona
where codigo
between '1001' and '1003';
IN
SELECT * FROM dbo.persona
WHERE primnom IN ('carlos', 'manuel');
NOT IN
SELECT * FROM dbo.persona
WHERE primnom NOT IN ('carlos', 'manuel');
alias estructura
select p.codigo,p.primnom,p.primapel,p.edad,p.sexo from dbo.persona as p,dbo.sexo as s
where p.sexo=s.idsexo and p.sexo=1;
lunes, 9 de marzo de 2020
Temario Modulo de base de datos diplomado de grado
Modulo Base de Datos.
Temario Modulo base de datos diplomado de Grado.
Descarga Motor PostgreSQL
Backup Base de datos.
1. Semana Uno. Backup Tablas Base de Datos Postgresql
Temario Modulo base de datos diplomado de Grado.
Descarga Motor PostgreSQL
Backup Base de datos.
1. Semana Uno. Backup Tablas Base de Datos Postgresql
jueves, 27 de febrero de 2020
Menu Sticky
Menu Sticky
Descargar proyecto demo sin menu Sticky
Descargar proyecto demo con menu Sticky
Obfuscator
CSS Menu Sticky
.sticky{
position: fixed;
top:0;
width: 100%;
}
Javascript Menu Sticky
<script>
/**javascript menu fijo**/
window.onscroll = function() {myFunction()};
var navbar = document.getElementById("navbar");
var sticky = navbar.offsetTop;
function myFunction() {
console.log(navbar);
console.log(sticky);
if (window.pageYOffset >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
}
}
</script>
Descargar proyecto demo sin menu Sticky
Descargar proyecto demo con menu Sticky
Obfuscator
CSS Menu Sticky
.sticky{
position: fixed;
top:0;
width: 100%;
}
Javascript Menu Sticky
<script>
/**javascript menu fijo**/
window.onscroll = function() {myFunction()};
var navbar = document.getElementById("navbar");
var sticky = navbar.offsetTop;
function myFunction() {
console.log(navbar);
console.log(sticky);
if (window.pageYOffset >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
}
}
</script>
viernes, 21 de febrero de 2020
border y gradiente Android Studio
header.xml
boton.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="@color/color1"
android:centerColor="@color/color2"
android:endColor="@color/color3"
android:type="linear" android:angle="180"> </gradient> </shape>
boton.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/color2" /> <corners android:radius="20dp" /> </shape>
color.xml
<color name="color1">#005073</color> <color name="color2">#107DAC</color> <color name="color3">#189AD3</color> <color name="letra">#FFFFFF</color>
Imagenes del Proyecto
descargar icono
Logo USB
Imagenes Figuras
miércoles, 19 de febrero de 2020
Imagen Demo Descarga
hr{
border: 0;
height: 1px;
background-image: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
}
hr{
border: 0;
height: 1px;
background-image: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
}
martes, 11 de febrero de 2020
Suscribirse a:
Entradas (Atom)