Scrip BD Ventas

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3 Server version: 5.1.51-community MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use reportes Database changed mysql> show tables -> ; +--------------------+ | Tables_in_reportes | +--------------------+ | alumnos | | alumnos_materias | | materias | +--------------------+ 3 rows in set (0.08 sec) mysql> select * from alumnos; +-----+-----------+-------+ | id | nombre | clave | +-----+-----------+-------+ | 123 | daniel | hola | | 213 | tejada | hi | | 312 | hernandez | hallo | | 456 | juan | adios | | 654 | camila | bye | +-----+-----------+-------+ 5 rows in set (0.02 sec) mysql> create database ventas; Query OK, 1 row affected (0.00 sec) mysql> use ventas; Database changed mysql> create table proveedores -> ( -> id_prove varchar (11), -> nombre varchar (60), -> contacto varchar (60), -> direccion varchar (60), -> email varchar (60), -> primary key (id_prove)); Query OK, 0 rows affected (0.06 sec) mysql> create table productos -> ( -> id_produc varchar (11), -> descripcion varchar (60), -> precio double, -> primary key (id_produc)); Query OK, 0 rows affected (0.13 sec) mysql> create table prove_produc

-> ( -> productos varchar (11), -> proveedor varchar (11), -> cantidad double, -> total double, -> foreign key (productos) references productos (id_produc), -> foreign key (proveedor) references proveedores (id_prove)); Query OK, 0 rows affected (0.19 sec) mysql> UPDATE productos,prove_produc SET total=(productos.precio*prove_produc.ca ntidad); Query OK, 4 rows affected (0.02 sec) Rows matched: 5 Changed: 4 Warnings: 0 mysql> select*from prove_produc; +-----------+-----------+----------+-------+ | productos | proveedor | cantidad | total | +-----------+-----------+----------+-------+ | 11 | 25 | 20 | 22000 | | 12 | 21 | 20 | 22000 | | 14 | 24 | 15 | 16500 | | 15 | 22 | 10 | 11000 | | 16 | 22 | NULL | NULL | +-----------+-----------+----------+-------+ 5 rows in set (0.00 sec) mysql>

Los datos fueron ingresados desde Sqlyog.

You might also like