Seguidores

jueves, 17 de octubre de 2019

clase de sql server

 INSERTAR REGISTROS DE TODO TIPO 

ENLACES
https://www.tutorialesprogramacionya.com

 http://artespixel.com/docs/ingenieria/sql/Semana13-ejercicios.pdf
SQL
https://docs.microsoft.com/es-es/sql/t-sql/queries/select-examples-transact-sql?view=sql-server-ver15#r-using-union-of-two-select-statements-with-order-by

insert into productos puedes canbiar este nombre de acuerdo ala tabla
values ('PR002','DISCO DURO SEAGATE 2 TB',450);
insert into productos
values ('PR003','MOUSE INALAMBRICO HP BLUETOOTH',35);
insert into productos
values ('PR004','CAMARA DIGITAL CANON',550);
insert into productos
values ('PR005','IMPRESORA CANON',420)

VER LOS REGISTROS INSERTADOS
select * from productos
 select * from ventas
select * from clientes

REGISTRO DE CLIENTES
insert into clientes
values ('72419337','franklin','huasacca barrial','12345678910','jr.bolivar');
CODIGO PARA VER SOLO ALGUNOS
CODIGO PARA JUNTAR NOMBRE Y APELLIDO
select dni,nombre ,apellidos from clientes

select dni,nombre  from clientes

CODIGO PARA JUNTAR NOMBRE Y APELLIDO
select dni,nombre +apellidos from clientes

 CODIGO PARA VER Y SEPARAR
select dni,(nombre + '      ' + apellidos) from clientes

CREAR UNA TABLA DE VENTAS
insert into ventas
values ('100050001','17-10-19','72419335','PR001',1)

insert into ventas

values ('100050001','72419332','PR001',1,17-10-19)

CLASE DE SQL SERVER 2

CODIGO PARA VER Y JUNTAR de la tabla de clientes y ventas

select v.ndoc, v.dni, c.nombre
from ventas v
INNER JOIN clientes c ON v.dni =c.dni
*********************************************
select v.ndoc, v.dni, (c.nombre+' '+C.apellidos)

from ventas v

INNER JOIN clientes c ON v.dni =c.dni
*********************************
PARA ELIMINAR UNA FILA
delete from productos where codigo='pr001'
*********************************************
CODIGO PARA REGISTROS
update  productos
set descripcion='sapatoss'where codigo='pro14'
******************************************
CODIGO PARA PRECIO
update  productos
set precio=100 where codigo='pro14'
**************************************
CODIGO PARA CAMBIAR TODO
update  productos
set descripcion='sapatoss', precio=315
where codigo='pro14'
********************************
paCODIGO PARA INSERTAR
DATOS
update ventas
set tipodoc='B'
where ndoc='100050001'
update ventas
set vendedor='v1'
where ndoc='100050001'
*********************
insert into ventas
values ('100050001','72419332','PR001',1,17-10-19,'A','V1'
*****************************
codigo para cambiar codigo
update ventas
set codigo='PR002'
where ndoc ='100050002'

*************************
CODIGO PARA CAMBIAR CANTIDAD
update ventas
set cantidad=4
where ndoc ='100050003'
*************************
CODIGO PARA VER VENTAS COMPLETAS

select v.ndoc, v.tipodoc,v.codigo,p.descripcion, v.cantidad,p.precio ,(v.cantidad * p.precio),c.nombre+'   '+apellidos

from ventas v
INNER JOIN productos p ON v.codigo =p.codigo
INNER JOIN clientes c  ON v.dni =c.dni
*********************************************
CREAR UNA TABLA

CODIGO PARA INSERTAR CONTACTO
insert into personas
values('96601','JUAN','PEREZ','AV.EL SOL')
*******************************************************
PARA VER EL RESULTADO

SELECT * FROM personas








*******************************************************
CREACION DE UNA TABLA LLAMADA WHATSAPP

















CODIGO PARA INSERTAR EN WHATSAPP
insert into whatsapp
values('96610','96620','ROMEL');
CODIGO PARA VER RESULTADO
select p.numero, p.nombre,w.ncontacto,w.nombre
from personas p
INNER JOIN whatsapp w ON p.numero =w.numero
******************************
CODIGO PARA VER CONTANCTO DE UN CLIENTE
select p.numero, p.nombre,w.ncontacto,w.nombre
from personas p
INNER JOIN whatsapp w ON p.numero =w.numero
where p.nombre like 'ROMEL HENRY'









******************************************************
CREAR TABLA DE CHAT


















CODIGO PARA INSERTAR
insert into chat
values('96602','96610',21/10/2019,'hola mary');
insert into chat
values('96610','96602',21/10/2019,'te invito a salir');

*9*******************
insert into chat
values('96602','96620',21/10/2019,'efrain realisate el trabajo');
insert into chat
values('96620','96602',21/10/2019,'no todavia');

**************************
CODIGO PARA VER EL CONTACTO DE ROMEL
select c.numero ,p.nombre, c.ncontacto ,c.fecha,c.mensage
from chat c
INNER JOIN personas p ON c.numero =p.numero
where p.nombre like 'ROMEL HENRY
*******************
CODIGO PARA VER EL CONTACTO DE ROMEL + DIRECCION

select c.numero ,p.nombre, c.ncontacto ,c.fecha,c.mensage,p.direccion
from chat c
INNER JOIN personas p ON c.numero =p.numero
where p.nombre like 'ROMEL HENRY'
*****************************
CLASE DE SQL SERVER 2

CODIGO PARA CREAR UNA DATABASE
create database empleados












CODIGO PARA INSERTAR
insert into dbo.empleado values('1968','','','','','',0,'','')

="insert into dbo.emleado values('"&A2&"','','','','','',0,'','')"

insert into dbo.empleado values('1968','','','','','',0,'','')


insert into dbo.empleado values('1968','Burgos','Jeronimo','Palmira','Administración','Administrativo',0,'30046','18899')


=DIA(H2)&"/"&MES(H2)&"/"&AÑO(H2)

CODIGO PARA SAVER EL MAXIMO SALARIO
select Max (salario) from dbo.empleado
CODIGO PARA SA BER EL MINIMO SALARIO
select MIN (salario) from dbo.empleado
CODIGO PARA SABER EL avg 
select avg (salario) from dbo.empleado
CODIGO PARA SAVER LA SUMA DE TODOS
select SUM (salario) from dbo.empleado
CODIGO PARA CONTAR
select COUNT (salario) from dbo.empleado
CODIGO PARA NOMBRE Y SALARIO
select nombre ,SUM(salario)
from empleado group by nombre
CODIGO PARA ver salario de cada area
select area ,SUM(salario)
from empleado group by area





martes, 15 de octubre de 2019

ELIMINAR

<html>
<link rel="stylesheet" href="css/sin_linea.css">
<?php
include "conectar.php";
$cod=$_GET['id']."";
$sql="select * from producto where codigo='$cod'";
$res=mysql_query($sql,$conec);
while($row=@mysql_fetch_array($res))  
{
    $ncod=$row['codigo'];
    $ndes=$row['descripcion'];
    $npre=$row['precio'];
    
}
?>
<body bgcolor="#00ace6">
    <header> <center>
<h3>eliminar  productos </h3></center></header>
<form method="post"action="producto_eli.php">
<fieldset>
<legend>
datos del producto
</legend> <table border="1">
    <tr>
<td>CODIGO</td><td><input type"text" name="txcod" id="txcod"  value="<?php echo $ncod;?>"></td>
</tr><tr>
 <td>    DESCRIPCION </td> <td><input type"text" name="txdes" id="txdes"  disabled value="<?php echo $ndes;?>"></td> </tr>
 <tr>
 <td> PRECIO </td><td><input type"text"name="txpre" id="txpre" disabled value="<?php echo $npre;?>"></td></tr>
 </tr></table >
</fieldset>


<fieldset>
    <legend> opciones
    </legend>
    <button>  <input type="submit" value="eliminar"name="e"id="e">  </button>
    <button> <a href="man_producto.php">salir</a> </button></fieldset>
    <?php
include("conectar.php");
$ecod=$_POST ['txcod'];

if ($_POST['e'])
 {
    mysql_query("set names 'utf8'");
    $insert=("delete from producto where codigo='$ecod'");
    $registros=mysql_query($insert,$conec);
    echo"<meta http-equiv='refresh' content='1 url=man_producto.php' target='_self'>";
}
?>



</form>
<body>

    <style>
        TR:HOVER {
background:#EEEEEE;
}
button{
                text-aligncenter;
                colorwhite;
                background-color:black; rgb(211, 15, 25);
                 padding5px;
                 font-size18px;
                 font-familyImpact;
            }
            header{

background-color#24282b;

color#fff;

padding-top10px;

min-height30px;

border-bottom2px solid #1293d4;



}
    </style>

</html>

color a button

 <td> <a href="http://localhost/3/cliente.php" target="derecha" >
<span style="background-color: rgb(12, 12, 11)"
class="boton">lista de clientes </span></a><br><br>

viernes, 11 de octubre de 2019

clase numero 10

CREACION DE UNA BASE DE DATOS CON PHP en MySql

CODIGO PARA CONECTAR BASE DE DATOS 1
<?php
$host ="localhost";
$usuario ="root";
$password="root";
$database="tienda1";

$conec=@mysql_connect($host,$usuario,$password) or die(mysql_error());
$db =@mysql_select_db($database,$conec) or die(mysql_error());
?>
conectar.php

CODIGO PARA LA LISTA 1
<html>
<?php
include "conectar.php";
?>
<body>
<h3>LISTA DE PRODUCTOS </h3> <br> 
<hr>
<table border='1'>
<tr><td>CODIGO</td> <td>    DESCRIPCION </td> <td> PRECIO </td>
 </tr>
<?php
$sql="select * from producto";
$res=mysql_query($sql,$conec);

while($row=@mysql_fetch_array($res))
    echo"";
    echo"<tr>"
    echo"<td>"echo $row['codigo']; echo"</td>";
    echo"<td>"echo $row['descripcion']; echo"</td>";
    echo"<td>"echo $row['precio']; echo"</td>";
     echo"</tr>"
    echo"";
}
?> 
</table>
<body>
</html>

CODIGO 2
<?php
$host ="localhost";
$usuario ="root";
$password="root";
$database="clientes";
$conec=@mysql_connect($host,$usuario,$password) or die(mysql_error());
$db =@mysql_select_db($database,$conec) or die(mysql_error());
?>


CODIGO DE CLIENTES 2
<html> <link rel="stylesheet" href="css/sin_linea.css"> <?php include "conectar1.php"; ?> <body bgcolor="#00ace6"> <header> <center> <h3>lista de clientes </h3></center></header> <form method="post"action="cliente.php"> <fieldset> <legend> datos del cliente </legend> <table border="1"> <tr> <td>dni</td><td><input type= "text" name="txcod" id="txcod"></td> </tr><tr> <td> nombre </td> <td><input type= "text" name="txdes" id="txdes"></td> </tr> <tr> <td> direccion </td><td><input type= "text"name="txpre" id="txpre"></td></tr> </tr></table > </fieldset> <fieldset> <legend> lista de clientes </legend> <table border='1'> <tr bgcolor="#FF0000"> <td>CODIGO</td> <td> DESCRIPCION </td> <td> PRECIO </td> </tr> <?php $sql="select * from cliente1"; $res=mysql_query($sql,$conec); while($row=@mysql_fetch_array($res)) { echo""; echo"<tr bgcolor= #b38600>"; echo"<td>"; echo $row['dni']; echo"</td>"; echo"<td>"; echo $row['nombre']; echo"</td>"; echo"<td>"; echo $row['direccion']; echo"</td>"; echo"</tr>"; echo""; } ?> </table></fieldset> <fieldset> <legend> opciones </legend> <button> <input type="submit" value="guardar" name="g" id="g"> </button> <button> <input type="button" value="salir"> </button></fieldset> <?php mysql_query("set names'utf8'"); $sql="select * from cliente1"; $result=mysql_query($sql,$conec); $codi=$_POST['txcod']; $desc=$_POST['txdes']; $prec=$_POST['txpre']; $sql="insert into cliente1(dni,nombre,direccion) values ('$codi','$desc','$prec')"; $result=mysql_query($sql,$conec); ?> </form> <body> <style> TR:HOVER { background:#EEEEEE; } button{ text-align: center; color: white; background-color:black; rgb(211, 15, 25); padding: 5px; font-size: 18px; font-family: Impact; } header{ background-color: #24282b; color: #fff; padding-top: 10px; min-height: 30px; border-bottom: 2px solid #1293d4; } </style> </html>

CODIGO FINAL DE LISTA DE PRODUCTOS

<html>
<link rel="stylesheet" href="css/sin_linea.css">
<?php
include "conectar.php";
?>
<body bgcolor="#00ace6">
    <header> <center>
<h3>mantenimiento de productos </h3></center></header>
<form method="post"action="producto_new.php">
<fieldset>
<legend>
datos del producto
</legend> <table border="1">
    <tr>
<td>CODIGO</td><td><input type= "text" name="txcod" id="txcod"></td>
</tr><tr>
 <td>    DESCRIPCION </td> <td><input type= "text" name="txdes" id="txdes"></td> </tr>
 <tr>
 <td> PRECIO </td><td><input type= "text"name="txpre" id="txpre"></td></tr>
 </tr></table >
</fieldset>
<fieldset>
    <legend> lista  de productos </legend>
<table border='1'>
<tr bgcolor="#FF0000">
<td>CODIGO</td>
 <td>    DESCRIPCION </td> 
 <td> PRECIO </td>
 </tr>
<?php
$sql="select * from producto";
$res=mysql_query($sql,$conec);

while($row=@mysql_fetch_array($res))
    echo"";
    echo"<tr bgcolor= #b38600>"; 
    echo"<td>"; echo $row['codigo']; echo"</td>";
    echo"<td>"; echo $row['descripcion']; echo"</td>";
    echo"<td>"; echo $row['precio']; echo"</td>";
     echo"</tr>"; 
    echo"";
}
?> 
</table></fieldset>
<fieldset>
    <legend> opciones
    </legend>
    <button>  <input type="submit" value="guardar"name="g"id="g">  </button>
    <button> <input type="button" value="salir"> </button></fieldset>
    <?php


mysql_query("set names'utf8'");
if($_POST['txcod']=='' and $_POST['g'])
{}
else
 {
    if ($_POST['txcod']=='')
    {   echo "Faltan datos";}
    else
    {
        $codi=$_POST['txcod'];
        $desc=$_POST['txdes'];
        $prec=$_POST['txpre'];
        $sql="insert into producto (codigo,descripcion,precio)
              values ('$codi','$desc','$prec')";
        $result=mysql_query($sql,$conec);
echo"<meta http-equiv='refresh'content='l':url=producto_new.php";
    }
}

?>
</form>
<body>

    <style>
        TR:HOVER {
background:#EEEEEE;
}
button{
                text-align: center;
                color: white;
                background-color:black; rgb(211, 15, 25);
                 padding: 5px;
                 font-size: 18px;
                 font-family: Impact;
            }
            header{

background-color: #24282b;

color: #fff;

padding-top: 10px;

min-height: 30px;

border-bottom: 2px solid #1293d4;



}
    </style>

</html>
enlace de los similares
http://artespixel.com/3.rar





viernes, 4 de octubre de 2019

novena clase


<?php
$host ="localhost";
$usuario ="root";
$password="root";
$database="tienda1";

$conec=@mysql_connect($host,$usuario,$password) or die(mysql_error());
$db =@mysql_select_db($database,$conec) or die(mysql_error());
?>

<body>
VER PRODUCTOS <br>

<?php
$sql="select * from producto";
$res=mysql_query($sql,$conec);

while($row=@mysql_fetch_array($res))
{
echo $row['codigo'];
echo $row['descripcion'];
echo $row['precio'];
echo "<br>";
}

?>

<body>
</html>

jueves, 3 de octubre de 2019

octava clase

CODIGO PARA PROMEDIO

<html>
    <body bgcolor="green">
        


<title> Estructuras condicionales </title>
Uso de las estructuras condicionales IF <br>
ingreso de Notas y solucionar Notas promediales <br><br>
Nombre del Alumno Nota1 Nota 2 Nota 3 Promedio <br>
<input type="button" value ="promedio" onclick ="prom();"> <br>
<input type="text" id="tnom" size="20">
<input type="text" id="t1"value="0" size="4">
<input type="text" id="t2" value="0"  size="4">
<input type="text" id="t3" value="0"  size="4">
<input type="text" id="tprom" value="0" size="4">
<input type="text" id="tobs" value="0"size="15">
<br>


<script>
function prom(){
    var n1=document.getElementById('t1').value;
    var n2=document.getElementById('t2').value;
    var n3=document.getElementById('t3').value;
    var pro=(parseInt(n1)+parseInt(n2)+parseInt(n3))/3;
    document.getElementById('tprom').value=pro
    if (pro<10.4){
        document.getElementById('tobs').value="desaprobado"
    } else{
        document.getElementById('tobs').value="aprobado"
    }
}


</script>
CODIGO PARA TU  PROGRAMA HTML <br><fieldset>
<textarea>
    
        <html>
                <title> Estructuras condicionales </title>
                Uso de las estructuras condicionales IF <br>
                ingreso de Notas y solucionar Notas promediales <br><br>
                Nombre del Alumno Nota1 Nota 2 Nota 3 Promedio <br>
                <input type="text" id="t1" size="16">
                <input type="text" id="t2" size="4">
                <input type="text" id="t1" size="4">
                <input type="text" id="t1" size="4">
                <input type="text" id="t1" size="4">
                <br>
                <input type="button" id="b1" value="Promedio">
                </html>
</textarea></fieldset>
</body></html>


CODIGO PARA UNA TIENDA
<html>
<body style="background-color:rgb(255,0,0);">
</body>
<font size="10" color="black">BODEGA "ELITA"</font>
<hr>
<body background="bg.jpg">
<form name="examen" method="">
<h2>Cantidad &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Descripcion &nbsp;&nbsp;
&nbsp;&nbsp;Precio &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="total" onclick="TOT();">
</h2>
<p>
<input type="text" id="t1" value="6" size="08">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t2" value="4" size="15">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t3" value="2" size="7">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t4" value="0" size="7">
<p>
<input type="text" id="t5" value="4" size="08">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t6" value="8" size="15">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t7" value="6" size="7">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="t8" value="0" size="7">
<hr>
<font size="6">Subtotal</font>&nbsp;&nbsp; <input type="text" id="tp" size="8">
<p>
<font size="6">Descuento del 10%</font>
<br>
<input type="radio" name="radio1" id="radio1" />Si<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="y9" size="5"><p>
<input type="radio" name="radio1" id="radio1" />No<br>
<hr>
<input type="button" name="result" id="result" value="RESPUESTA" onclick="cont()"/>
<input type="text" id="y9" size="5">
</form>
<script>
function TOT() {
var n1=document.getElementById('t1').value;
var n2=document.getElementById('t2').value;
var n3=document.getElementById('t3').value;
var total= parseInt(n1) + parseInt(n2) + parseInt(n3) ;
document.getElementById('t4').value=total
var n1a=document.getElementById('t5').value;
var n2a=document.getElementById('t6').value;
var n3a=document.getElementById('t7').value;
var totala= parseInt(n1a) + parseInt(n2a) + parseInt(n3a) ;
document.getElementById('t8').value=total
var tit= parseInt(total)/2 + parseInt(totala)/2;
document.getElementById('tp').value=tit
}
</script>

</html>
OPERACIONES
<html>
<body bgcolor="grenn">
<script>
function cont() {
var c=0;
if(document.forms['examen']['radio1'][0].checked)
{ c++;
var n1=document.forms['examen']['t1'].value;
var n2=document.forms['examen']['t2'].value;
var sum=parseInt(n1)+ parseInt(n2);
document.forms['examen']['tr'].value=sum;
}
else
{ var n1=document.forms['examen']['t1'].value;
var n2=document.forms['examen']['t2'].value;
var res=parseInt(n1)- parseInt(n2);
document.forms['examen']['tr'].value=res; }
}
</script>
<form name="examen">
Numero 01 <input type="text" id="t1"><br>
Numero 01 <input type="text" id="t2">
<hr>
<input type="radio" name="r1" id="radio1"> Sumar
<input type="radio" name="r1" id="radio1"> Restar
<hr>
<input type="button" Value="Respuesta" onclick="cont();">
<input type="text" id="tr">
</form>
</body>
</html>
tabla
<html>
<fieldset style="width:20%">
Tabla de multiplicar <br>
</fieldset>
<fieldset style="width:20%">
<script>
var i=0; for (i=0;i<=12;i++)
{
document.write("N. " + i +" x 2 =" );
document.write("<font color=blue>" + (i*2) + "</font>");
document.write("<br />");
}
document.write("<hr>");
for (i=0;i<=12;i++)
{
document.write("N. " + i+" x 3 =" + (i*3 ) );
document.write("<br />");
}
document.write("<hr>");
for (i=0;i<=5;i++)
{
document.write("N. " + i+" x 4 =" + (i*4 ) );
document.write("<br />");
}
document.write("<hr>");
for (i=0;i<=5;i++)
{
document.write("N. " + i+" x 5 =" + (i*5 ) );
document.write("<br />");
}
</script>
</html>

</html>

imagen 


<html>
<body background="01.jpg">
</body>
<br>
<center><H1><marquee behaviador="alterne" hspace="400" scrollamount="10">
<font face="Cooper" color="black">
Ayacucho - Peru
</font>
</marquee><H1></center>
<body bgcolor="#ACD1D0">
</body>
<h1> Ciudad de Ayacucho </h1>
La fe del pueblo ayacuchano se refleja en los templos construidos a lo largo de la ciudad. Además, disfruta la arquitectura colonial presente en cada rincón.
<br><br>
<button type="button" onclick="verfoto1()">platos tipicos</button>
<button type="button" onclick="verfoto2()">carnavales</button>
<button type="button" onclick="verfoto3()">semana santa</button>
<div id="myDiv" style="border:1px solid black; height:400;
width:400;">
Imagen capturada</div>
<script>
function verfoto1()
{ document.getElementById("myDiv").style.backgroundImage="url('platos.png')";}
function verfoto2()
{ document.getElementById("myDiv").style.backgroundImage="url('rural.jfif')";}
function verfoto3()
{ document.getElementById("myDiv").style.backgroundImage="url('santa.jpg')";}
</script>
</body>
</html>

index

<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="miestilo.css">
</head>
<body>
<div id="titulo">
<h1>Bienvenidos a mi Pagina Web</h1>
</div>
<div id="amarillo">
<img src="imagenes/image01.png">
</div>
<div id="verde">
<p>
Crea un sitio web de aspecto profesional en sólo 3 fáciles pasos. Escoge entre miles de diseños de sitios personalizados para tu negocio..
</p>
<img class="cambio" src="imagenes/image02.png">
<img class="cambio" src="imagenes/image04.png">
<img class="cambio1"src="imagenes/image05.png">
</div>
</body>
</html>

cambio de dolares

<html>
        <h1> Convertirde soles a dolares </h1> 
        <hr>
            Valor de Soles <input type="text" id="txvalor"> <br>
            Tipo de Cambio <input type="text" id="txcambio">
        <hr>
           <input type="button" value="Total">
           <input type="text" id="txtot">
           dolares
        
        </html>








netbeans java

LEJGUAJE DE PROGRAMACION I Ejercicios sobre operadores aritméticos Java Ejercicio 1: Si a, b y c son variables enteras con valores a=8, b=...