Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*create database evidenta;
- use evidenta;
- create table produse
- (
- Producator char(1) not null,
- Model varchar(4) not null,
- Tip varchar(10) not null
- );
- create table pc_uri
- (
- Cod int not null,
- Model varchar(4) not null,
- Viteza decimal(3,0) not null,
- Ram decimal(3,0) not null,
- Hd decimal(2,0) not null,
- Cd varchar (3) not null,
- Pret float not null
- );
- create table laptop_uri
- (
- Cod int not null,
- Model varchar(4) not null,
- Viteza decimal(3,0) not null,
- Ram decimal(3,0) not null,
- Hd decimal(2,0) not null,
- Pret float not null,
- Ecran int not null
- );
- create table imprimante
- (
- Cod int not null,
- Model varchar(4) not null,
- Color char(2) not null,
- Tip varchar(6) not null,
- Pret float not null
- );
- insert into produse values ('B', 1121, 'PC');
- insert into produse values ('A', 1232, 'PC');
- insert into produse values ('B', 1233, 'PC');
- insert into produse values ('E', 1260, 'PC');
- insert into produse values ('A', 1276, 'Imprimante');
- insert into produse values ('D', 1288, 'Imprimante');
- insert into produse values ('A', 1298, 'Laptop_uri');
- insert into produse values ('C', 1321, 'Laptop_uri');
- insert into produse values ('A', 1401, 'Imprimante');
- insert into produse values ('A', 1408, 'Imprimante');
- insert into produse values ('D', 1433, 'Imprimante');
- insert into produse values ('E', 1434, 'Imprimante');
- insert into produse values ('B', 1750, 'Laptop_uri');
- insert into produse values ('A', 1752, 'Laptop_uri');
- insert into produse values ('E', 2111, 'PC');
- insert into produse values ('E', 2112, 'PC');
- insert into imprimante values (1 , '1276' , 'nu' , 'Laser' , 400);
- insert into imprimante values (2 , '1433' , 'da' , 'Jet' , 270);
- insert into imprimante values (3 , '1434' , 'da' , 'Jet' , 290);
- insert into imprimante values (4 , '1401' , 'nu' , 'Matrix' , 150);
- insert into imprimante values (5 , '1408' , 'nu' , 'Matrix' , 270);
- insert into imprimante values (6 , '1288' , 'nu' , 'Laser' , 400);
- INSERT INTO pc_uri VALUES ( 1, 1232, 500, 64 , 5, '12x', 600 ), ( 2, 1121, 750, 128, 14, '40x', 850 ),
- ( 3 , 1233, 500, 64, 5, '12x', 600 ), ( 4, 1121, 600, 128, 14, '40x', 850 ), ( 5, 1121, 600, 128, 8, '40x', 850 ),
- ( 6, 1233, 750, 128, 20, '50x', 950 ), ( 7, 1232, 500, 32, 10, '12x', 400 ), ( 8, 1232, 450, 64, 8, '24x', 350 ),
- ( 9, 1232, 450, 32, 10, '24x', 350 ), ( 10, 1260, 500, 32, 10, '12x', 350 ), ( 11, 1233, 900, 128, 40, '40x', 980 );
- insert into laptop_uri values (1,1298,350,32,4,700,11),(2,1231,500,64,8,970,12),(3,1750,750,128,12,1200,14),(4,1298,600,64,10,1050,15),(5,1752,750,128,10,1150,14),(6,1298,450,64,10,950,120);*/
- select producator
- from pc_uri inner join produse on pc_uri.model = produse.model
- where viteza > 450 group by producator;
- select Model , Pret
- from imprimante where Pret = (select max(Pret) FROM Imprimante);
- select avg(Viteza)
- from pc_uri;
- select avg()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement