예제 #1
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta5_Click(object sender, EventArgs e) //SE PARAMETRIZA LAS LETRAS
        {
            MessageBox.Show("select p.id_pelicula 'Código de Película', p.nombre 'Película', g.id_genero 'Código de Genero', nombre, sum(cantidad * d.precio) 'Importe', sum(cantidad)'Cantidad total', " +
                            "avg(d.precio) 'Precio promedio' from peliculas p join generos g on p.id_genero = g.id_genero join funciones f on f.id_pelicula = p.id_pelicula join detalles_comprobante d on d.id_funcion = f.id_funcion " +
                            " join comprobantes c on c.id_comprobante = d.id_comprobante where p.nombre like '[g-p]%' or g.descripcion in ('thriller', 'terror', 'horror') group by p.id_pelicula, p.nombre, g.id_genero, nombre order by 2, 4 desc",
                            "INSTRUCIONES", MessageBoxButtons.OK, MessageBoxIcon.Information);

            consulta = "select p.id_pelicula 'Código de Película', p.nombre 'Película', g.id_genero 'Código de Genero', nombre, sum(cantidad * d.precio) 'Importe', sum(cantidad)'Cantidad total', " +
                       "avg(d.precio) 'Precio promedio' from peliculas p join generos g on p.id_genero = g.id_genero join funciones f on f.id_pelicula = p.id_pelicula join detalles_comprobante d on d.id_funcion = f.id_funcion " +
                       " join comprobantes c on c.id_comprobante = d.id_comprobante where p.nombre like '[g-p]%' or g.descripcion in ('thriller', 'terror', 'horror') group by p.id_pelicula, p.nombre, g.id_genero, nombre order by 2, 4 desc";

            consultero = Consultero.C5;

            ocultarBotonesConsultas();

            if (rbtnConsulta5.Checked == true)
            {
                txtConsulta4c2.Enabled = true;
                txtConsulta4.Enabled   = true;

                consultaParametrizada = "select p.id_pelicula 'Código de Película', p.nombre 'Película', g.id_genero 'Código de Genero', nombre, sum(cantidad * d.precio) 'Importe', sum(cantidad)'Cantidad total', " +
                                        "avg(d.precio) 'Precio promedio' from peliculas p join generos g on p.id_genero = g.id_genero join funciones f on f.id_pelicula = p.id_pelicula join detalles_comprobante d on d.id_funcion = f.id_funcion " +
                                        " join comprobantes c on c.id_comprobante = d.id_comprobante where p.nombre like '[" + txtConsulta5.Text + "-" + txtConsulta5c2 + "]%' or g.descripcion in ('thriller', 'terror', 'horror') group by p.id_pelicula, p.nombre, g.id_genero, nombre order by 2, 4 desc";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #2
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta10_Click(object sender, EventArgs e) //SE PARAMETRIZA LA COMPARACIÓN DE FECHA DE NACIMIENTO
        {
            MessageBox.Show("Select d.nombre 'Nombre Director',d.apellido 'Apellido Director', p.nombre 'Pais Director', d.fecha_nacimiento 'Fecha Nacimiento', pe.nombre 'Nombre Pelicula',i.Idioma 'Idioma' " +
                            "From peliculas pe join directores d on pe.id_director = d.id_director join paises p on pe.id_pais = p.id_pais join idiomas i on pe.id_idioma = i.id_idioma " +
                            "Where fecha_nacimiento > 1950 and reseña like '%óscar%' and i.Idioma in ('ingles') Order by d.nombre", "Instrucciones", MessageBoxButtons.OK, MessageBoxIcon.Information);

            consulta = "Select d.nombre 'Nombre Director',d.apellido 'Apellido Director', p.nombre 'Pais Director', d.fecha_nacimiento 'Fecha Nacimiento', pe.nombre 'Nombre Pelicula',i.Idioma 'Idioma' " +
                       "From peliculas pe join directores d on pe.id_director = d.id_director join paises p on pe.id_pais = p.id_pais join idiomas i on pe.id_idioma = i.id_idioma " +
                       "Where fecha_nacimiento > 1950 and reseña like '%óscar%' and i.Idioma in ('ingles') Order by d.nombre";

            consultero = Consultero.C10;

            ocultarBotonesConsultas();

            if (rbtnConsulta10.Checked == true)
            {
                txtConsulta10.Enabled = true;

                consultaParametrizada = "Select d.nombre 'Nombre Director',d.apellido 'Apellido Director', p.nombre 'Pais Director', d.fecha_nacimiento 'Fecha Nacimiento', pe.nombre 'Nombre Pelicula',i.Idioma 'Idioma' " +
                                        "From peliculas pe join directores d on pe.id_director = d.id_director join paises p on pe.id_pais = p.id_pais join idiomas i on pe.id_idioma = i.id_idioma " +
                                        "Where fecha_nacimiento > " + txtConsulta10.Text + " and reseña like '%óscar%' and i.Idioma in ('ingles') Order by d.nombre";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #3
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta4_Click(object sender, EventArgs e) //SE PARAMETRIZA EL RANGO DE CANTIDADES EN LA CONDICION DE WHERE
        {
            MessageBox.Show("select f.id_funcion, avg(cantidad*dc.precio)'Importe promedio', min(fecha)'1er venta' from comprobantes c join detalles_comprobante dc on c.id_comprobante = dc.id_comprobante  join " +
                            "funciones f on f.id_funcion = dc.id_funcion where cantidad between 1 and 50 group by fecha,f.id_funcion having sum(cantidad * dc.precio) > " +
                            "(select avg(cantidad * precio) from detalles_comprobante where id_funcion = f.id_funcion)", "Instrucciones", MessageBoxButtons.OK, MessageBoxIcon.Information);

            consulta = "select f.id_funcion, avg(cantidad*dc.precio)'Importe promedio', min(fecha)'1er venta' from comprobantes c join detalles_comprobante dc on c.id_comprobante = dc.id_comprobante  join " +
                       "funciones f on f.id_funcion = dc.id_funcion where cantidad between 1 and 50 group by fecha,f.id_funcion having sum(cantidad * dc.precio) > " +
                       "(select avg(cantidad * precio) from detalles_comprobante where id_funcion = f.id_funcion)";

            consultero = Consultero.C4;

            ocultarBotonesConsultas();

            if (rbtnConsulta4.Checked == true)
            {
                txtConsulta4c2.Enabled = true;
                txtConsulta4.Enabled   = true;
                consultaParametrizada  = "select f.id_funcion, avg(cantidad*dc.precio)'Importe promedio', min(fecha)'1er venta' from comprobantes c join detalles_comprobante dc on c.id_comprobante = dc.id_comprobante  join " +
                                         "funciones f on f.id_funcion = dc.id_funcion where cantidad between " + txtConsulta4.Text + " and " + txtConsulta4c2.Text + " group by fecha,f.id_funcion having sum(cantidad * dc.precio) > " +
                                         "(select avg(cantidad * precio) from detalles_comprobante where id_funcion = f.id_funcion)";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #4
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta8_Click(object sender, EventArgs e)//SE PARAMETRIZA LA CANTIDAD DE AÑOS ANTERIORES DEL CUAL QUEREMOS CONOCER EL DETALLE
        {
            MessageBox.Show("Select c.id_comprobante 'Nro comprobante', f.rangoHorario 'Horario de la funcion',f.id_pelicula 'Nro de pelicula' " +
                            "From Comprobantes c join Detalles_Comprobante dc on c.id_comprobante = dc.id_comprobante join Funciones f on f.id_funcion = dc.id_funcion Where year(c.fecha) = year(getdate()) - 1" +
                            "and 200 < any(Select avg(precio * cantidad) From detalles_comprobante dc1 Where dc1.id_comprobante = c.id_comprobante and dc1.id_funcion = f.id_funcion)", "Instrucciones",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);

            consulta = "Select c.id_comprobante 'Nro comprobante', f.rangoHorario 'Horario de la funcion',f.id_pelicula 'Nro de pelicula' " +
                       "From Comprobantes c join Detalles_Comprobante dc on c.id_comprobante = dc.id_comprobante join Funciones f on f.id_funcion = dc.id_funcion Where year(c.fecha) = year(getdate()) - 1" +
                       "and 200 < any(Select avg(precio * cantidad) From detalles_comprobante dc1 Where dc1.id_comprobante = c.id_comprobante and dc1.id_funcion = f.id_funcion)";

            consultero = Consultero.C8;


            ocultarBotonesConsultas();

            if (rbtnConsulta8.Checked == true)
            {
                txtConsulta8.Enabled = true;

                consultaParametrizada = "Select c.id_comprobante 'Nro comprobante', f.rangoHorario 'Horario de la funcion',f.id_pelicula 'Nro de pelicula' " +
                                        "From Comprobantes c join Detalles_Comprobante dc on c.id_comprobante = dc.id_comprobante join Funciones f on f.id_funcion = dc.id_funcion Where year(c.fecha) = year(getdate()) - " + txtConsulta8.Text + " " +
                                        "and 200 < any(Select avg(precio * cantidad) From detalles_comprobante dc1 Where dc1.id_comprobante = c.id_comprobante and dc1.id_funcion = f.id_funcion)";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #5
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta9_Click(object sender, EventArgs e) //SE PARAMETRIZA LA FORMA DE PAGO Y DESCRIPCION DE FORMA DE COMPRA
        {
            MessageBox.Show("Select sum (cantidad*precio)'Cantidad Ganada' from detalles_comprobante dc, comprobantes c, formaDePagos fp, formaCompras Fc " +
                            "where fp.id_formadePago = c.id_formaPago and fc.id_formaCompra = c.id_formaCompra and c.id_comprobante = dc.id_comprobante " +
                            "and year(fecha) = year(getdate()) - 1 and   formaPago like 'Debito' and descripcion like '%Boleteria'", "Instrucciones", MessageBoxButtons.OK, MessageBoxIcon.Information);

            consulta = "Select sum (cantidad*precio)'Cantidad Ganada' from detalles_comprobante dc, comprobantes c, formaDePagos fp, formaCompras Fc " +
                       "where fp.id_formadePago = c.id_formaPago and fc.id_formaCompra = c.id_formaCompra and c.id_comprobante = dc.id_comprobante " +
                       "and year(fecha) = year(getdate()) - 1 and   formaPago like 'Debito' and descripcion like '%Boleteria'";

            consultero = Consultero.C9;

            ocultarBotonesConsultas();

            if (rbtnConsulta9.Checked == true)
            {
                cboFormaPago.Enabled   = true;
                cboFormaCompra.Enabled = true;

                consultaParametrizada = "Select sum (cantidad*precio)'Cantidad Ganada' from detalles_comprobante dc, comprobantes c, formaDePagos fp, formaCompras Fc " +
                                        "where fp.id_formadePago = c.id_formaPago and fc.id_formaCompra = c.id_formaCompra and c.id_comprobante = dc.id_comprobante " +
                                        "and year(fecha) = year(getdate()) - 1 and   formaPago like '" + cboFormaPago.Text + "' and descripcion like '%" + cboFormaCompra.Text + "'";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #6
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta3_Click(object sender, EventArgs e)//SE PARAMETRIZARA LISTA ID_DETALLE
        {
            MessageBox.Show("Select f.id_pelicula, nombre, avg(cantidad * dc.precio)'Importe promedio', sum(cantidad) 'Cantidad total' from peliculas p join funciones f on p.id_pelicula = f.id_pelicula join " +
                            "detalles_comprobante dc on f.id_funcion = dc.id_funcion where id_detalle not in (30, 10, 70, 55, 12) group by f.id_pelicula, nombre having avg(cantidad * dc.precio) < " +
                            "(select avg(cantidad * precio) from detalles_comprobante) ",
                            "Instrucciones", MessageBoxButtons.OK, MessageBoxIcon.Information);

            consulta = "Select f.id_pelicula, nombre, avg(cantidad * dc.precio)'Importe promedio', sum(cantidad) 'Cantidad total' from peliculas p join funciones f on p.id_pelicula = f.id_pelicula join " +
                       "detalles_comprobante dc on f.id_funcion = dc.id_funcion where id_detalle not in (30, 10, 70, 55, 12) group by f.id_pelicula, nombre having avg(cantidad * dc.precio) < " +
                       "(select avg(cantidad * precio) from detalles_comprobante)";

            consultero = Consultero.C3;

            ocultarBotonesConsultas();

            if (rbtnConsulta3.Checked == true)
            {
                txtConsulta3c2.Enabled = true;
                txtConsulta3.Enabled   = true;

                consultaParametrizada = "Select f.id_pelicula, nombre, avg(cantidad * dc.precio)'Importe promedio', sum(cantidad) 'Cantidad total' from peliculas p join funciones f on p.id_pelicula = f.id_pelicula join " +
                                        "detalles_comprobante dc on f.id_funcion = dc.id_funcion where id_detalle not in ( " + txtConsulta3.Text + ", " + txtConsulta3c2.Text + ", 70, 55, 12) group by f.id_pelicula, nombre having avg(cantidad * dc.precio) < " +
                                        "(select avg(cantidad * precio) from detalles_comprobante)";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #7
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta6_Click(object sender, EventArgs e) //SE PARAMETRIZA LOS TRES AÑOS QUE SE BRINDAN POR LA CONSULTA
        {
            MessageBox.Show("Select year(c.fecha)'Fecha', sum(cantidad)'Cantidad total', avg(precio)'Precio Promedio', sum(precio*cantidad)'Importe total' From comprobantes c join detalles_comprobante d " +
                            "on c.id_comprobante = d.id_comprobante Where year(fecha) in (2013, 2016, 2017) Group by year(c.fecha) having sum(precio * cantidad) > 2500 order by 4 desc",
                            "Instrucciones", MessageBoxButtons.OK, MessageBoxIcon.Information);
            consulta = "Select year(c.fecha)'Fecha', sum(cantidad)'Cantidad total', avg(precio)'Precio Promedio', sum(precio * cantidad)'Importe total' From comprobantes c join detalles_comprobante d " +
                       "on c.id_comprobante = d.id_comprobante Where year(fecha) in (2013, 2016, 2017) Group by year(c.fecha) having sum(precio * cantidad) > 2500 order by 4 desc";

            consultero = Consultero.C6;

            ocultarBotonesConsultas();

            if (rbtnConsulta6.Checked == true)
            {
                txtC1c1.Enabled = true;
                txtC1c2.Enabled = true;
                txtC1c3.Enabled = true;

                consultaParametrizada = "Select year(c.fecha)'Fecha', sum(cantidad)'Cantidad total', avg(precio)'Precio Promedio', sum(precio * cantidad)'Importe total' From comprobantes c join detalles_comprobante d " +
                                        "on c.id_comprobante = d.id_comprobante Where year(fecha) in (" + txtC1c1.Text + ", " + txtC1c2.Text + ", " + txtC1c3.Text + ") Group by year(c.fecha) having sum(precio * cantidad) > 2500 order by 4 desc";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #8
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta2_Click(object sender, EventArgs e)//SE PARAMETRIZA LA NACIONALIDAD DE LA PRIMER CONSULTA
        {
            MessageBox.Show("Select id_actor, nombre,nacionalidad From actores a Where a.nacionalidad in ('Argentina') and nombre not like '[A - F]%' and fecha_nacimiento < '1990/1/1' UNION Select id_pelicula, nombre, idioma " +
                            "From peliculas p join idiomas i  on p.id_idioma = i.id_idioma join clasificacionesPeliculas C on c.id_clasificacion = p.id_clasificacion join generos g  on  g.id_genero = p.id_genero " +
                            "Where i.idioma in ('Ingles') and C.clasificacion like '+16'  and g.descripcion like 'Terror' or g.descripcion like 'Accion' Order by 2",
                            "Instrucciones", MessageBoxButtons.OK, MessageBoxIcon.Information);
            consulta = "Select id_actor, nombre, nacionalidad From actores a Where a.nacionalidad in ('Argentina') and nombre not like '[A - F]%' and fecha_nacimiento < '1990/1/1' UNION Select id_pelicula, nombre, idioma " +
                       "From peliculas p join idiomas i  on p.id_idioma = i.id_idioma join clasificacionesPeliculas C on c.id_clasificacion = p.id_clasificacion join generos g  on  g.id_genero = p.id_genero " +
                       "Where i.idioma in ('Ingles') and C.clasificacion like '+16'  and g.descripcion like 'Terror' or g.descripcion like 'Accion' Order by 2";

            consultero = Consultero.C2;

            ocultarBotonesConsultas();

            if (rbtnConsulta2.Checked == true)
            {
                txtConsulta2.Enabled = true;

                consultaParametrizada = "Select id_actor, nombre, nacionalidad From actores a Where a.nacionalidad in ('" + txtConsulta2.Text + "') and nombre not like '[A - F]%' and fecha_nacimiento < '1990/1/1' UNION Select id_pelicula, nombre, idioma " +
                                        "From peliculas p join idiomas i  on p.id_idioma = i.id_idioma join clasificacionesPeliculas C on c.id_clasificacion = p.id_clasificacion join generos g  on  g.id_genero = p.id_genero " +
                                        "Where i.idioma in ('Ingles') and C.clasificacion like '+16'  and g.descripcion like 'Terror' or g.descripcion like 'Accion' Order by 2";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #9
0
        //----------------------------------------------------------------------------------------
        private void BtnConsulta1_Click_1(object sender, EventArgs e)//SE PARAMETRIZAN LOS NOMBRES DEL PRIMER SELECT
        {
            MessageBox.Show("Select id_actor, Nombre, Apellido, Nacionalidad from actores where nombre like " +
                            "'[C-H]%' and fecha_nacimiento between '1950/1/1' and '1970/12/31' UNION Select id_director, Nombre, Apellido," +
                            "Nacionalidad from Directores where nombre not like '[J-Q]%' and fecha_nacimiento " +
                            "between '1930/1/1' and '1980/12/31' Order By 3 desc", "Instrucciones", MessageBoxButtons.OK, MessageBoxIcon.Information);

            consulta = "Select id_actor, Nombre, apellido, Nacionalidad from actores where nombre like " +
                       "'[C-H]%' and fecha_nacimiento between '1950/1/1' and '1970/12/31' UNION Select id_director, Nombre, Apellido," +
                       "Nacionalidad from Directores where nombre not like '[J-Q]%' and fecha_nacimiento " +
                       "between '1930/1/1' and '1980/12/13' Order By 3 desc";
            consultero = Consultero.C1;

            ocultarBotonesConsultas();

            if (rbtnConsulta1.Checked == true)
            {
                txtConsulta1.Enabled   = true;
                txtConsulta1C2.Enabled = true;

                consultaParametrizada = "Select id_actor, Nombre, Apellido, Nacionalidad from actores where nombre like " +
                                        "'[" + txtConsulta1.Text + "-" + txtConsulta1C2.Text + "]%' and fecha_nacimiento between '1950/1/1' and '1970/1/1' UNION Select id_director, Nombre, Apellido," +
                                        "Nacionalidad from Directores where nombre not like '[J-Q]%' and fecha_nacimiento " +
                                        "between '1930/1/1' and '1980/12/11' Order By 3 desc";
                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }
예제 #10
0
        //----------------------------------------------------------------------------------------
        private void btnConsulta7_Click(object sender, EventArgs e)//SE PARAMETRIZA EL VALOR DE COMPARACIÓN
        {
            MessageBox.Show("Select id_Comprobante 'ID COMPROBANTE', fecha 'FECHA' From comprobantes c where 350 < " +
                            "(Select sum(cantidad * precio) From Detalles_Comprobante dc Where dc.id_comprobante = c.id_comprobante)", "Instrucciones", MessageBoxButtons.OK, MessageBoxIcon.Information);

            consulta = "Select id_Comprobante 'ID COMPROBANTE', fecha 'FECHA' From comprobantes c where 350 < " +
                       "(Select sum(cantidad * precio) From Detalles_Comprobante dc Where dc.id_comprobante = c.id_comprobante)";

            consultero = Consultero.C7;

            ocultarBotonesConsultas();

            if (rbtnConsulta7.Checked == true)
            {
                txtConsulta7.Enabled = true;

                consultaParametrizada = "Select id_Comprobante 'ID COMPROBANTE', fecha 'FECHA' From comprobantes c where " + txtConsulta7.Text + " < " +
                                        "(Select sum(cantidad * precio) From Detalles_Comprobante dc Where dc.id_comprobante = c.id_comprobante)";

                HideRadioButon();
            }
            btnConsultar.Enabled = true;
        }