0% found this document useful (0 votes)
9 views

Create

The document creates a database called Tienda_Informatica and two tables called Fabricantes and Articulos. It then inserts data into the tables and runs some queries on the data.

Uploaded by

Nicolas Cotari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Create

The document creates a database called Tienda_Informatica and two tables called Fabricantes and Articulos. It then inserts data into the tables and runs some queries on the data.

Uploaded by

Nicolas Cotari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CREATE 

DATABASE Tienda_Informatica;

CREATE table Fabricantes ( Codigo int(4) PRIMARY KEY AUTO_INCREMENT, N
ombre varchar(100) );

CREATE TABLE Articulos ( Codigo int(5) PRIMARY KEY AUTO_INCREMENT, Nom
bre varchar(100), Precio int(8), Fabricante int(4), FOREIGN KEY (Fabri
cante) REFERENCES fabricantes (Codigo) );

INSERT INTO `fabricantes`(`Nombre`) VALUES ('Nvidia'), ('Intel'), ('AM
D'), ('Aerocool'), ('Gigabyte'), ('Asus'), ('Samsung'), ('Apple'), ('M
SI'), ('Razer');

INSERT INTO `articulos`(`Nombre`, `Precio`, `Fabricante`) VALUES ('RTX
2080 Super','90000','1'), ('I7 9700K','67000','2'), ('Fuente 700w
RGB','16000','4'), ('Ryzen 5 3600x','45000','3'), ('Mother Z390
Elite','22000','5'), ('ROG Phone','300000','6'), ('S22
Ultra','245000','7'), ('Iphone 13 Pro Max','500000','8'), ('Vampiric
010','33000','9'), ('Laptop RAZER','23000','10');

1.1 SELECT `Nombre` FROM `articulos`


1.2 cuyo fabricante sea código 2
SELECT `Nombre`, `Precio` FROM `articulos` WHERE `Fabricante` = 2

1.3 SELECT `Nombre` FROM `articulos` WHERE `Precio` <= 20000


1.4 SELECT `Codigo`, `Nombre`, `Precio`, `Fabricante` FROM `articulos`
WHERE `Precio` BETWEEN 60000 AND 120000

1.5 SELECT `Nombre` as name, `Precio` / 200 as price FROM `articulos`

1.6 Ascedente: SELECT `Nombre`, `Precio` FROM `articulos` WHERE


`Precio` >= 15000 ORDER by Precio DESC
Descendente: SELECT `Nombre`, `Precio` FROM `articulos` WHERE
`Precio` >= 15000 ORDER by Precio

You might also like