Você está na página 1de 15

**Subiectul 1 1.

creare tabel CREATE TABLE carti (cod_carte NUMBER(6), titlu VARCHAR2 (30), autor VARCHAR2 (30 ), editura VARCHAR2 (30), data_aparitiei DATE, nr_pagini NUMBER (3), pret NUMBER (4)) 2. introducere date INSERT INTO carti VALUES (1, 'Amurg', 'colectiv', 'crizon', TO_DATE ('13 04 2008', 'DD MM YYYY'), 328, 18) INSERT INTO carti VALUES (2, 'Literatura Romana', 'colectiv', 'art', TO_DATE('23 03 2009', 'DD MM YYYY'), 420, 30) INSERT INTO carti VALUES (3, 'Bac Info', 'colectiv', 'Cygnus', TO_DATE ('15 04 2009', 'DD MM YYYY' ), 320, 30) INSERT INTO carti VALUES (4, 'Ion', 'Liviu Rebreanu', 'corint', TO_DATE ('13 09 2000', 'DD MM YYYY '), 200, 30) INSERT INTO carti VALUES (5, 'Padurea Spanzuratilor', 'Liviu Rebreanu', 'rao', TO_DATE ('5 10 2001 ', 'DD MM YYYY'), 150, 20) 3. cartile autorului x SELECT titlu FROM carti WHERE autor=:x; 4. editurile SELECT editura FROM carti WHERE pret=(SELECT max(pret) FROM carti) AND MONTHS_BETWEEN (data_aparitiei, SYSDATE)<=48; **Subiectul 2 1. creare tabel CREATE TABLE filme (zi_saptamana VARCHAR2(8), ora NUMBER (5,2), film VARCHAR2 (4 0), gen VARCHAR2 (20), post_tv VARCHAR2 (20)); 2. introducere date INSERT INTO filme VALUES ( 'luni', 20.00, 'Lost', 'thriller', 'Pro TV') INSERT INTO filme VALUES ( 'marti', 16.30, 'Tanar si nelinistit', 'soap', 'Pro TV') INSERT INTO filme VALUES ( 'vineri', 18.50, 'Two and a half man', 'comedie', 'AXN') INSERT INTO filme VALUES ( 'sambata', 15.00, 'Walker', 'actiune', 'TVR1') INSERT INTO filme VALUES ( 'sambata', 19.45, 'Harry Potter', 'aventura', 'Pro TV') 3. lista filme vineri dupa 13.00 si sambata dupa 16.00 SELECT film FROM filme WHERE (zi_saptamana='vineri' AND ora>=13) OR (zi_saptamana='sambata' AND ora>=16);

4. lista filme care nu sunt actiune si thriller SELECT film FROM filme WHERE gen!='actiune' AND gen!='thriller'; **Subiectul 3 1. creare tabel CREATE TABLE banci (cod NUMBER (6), nume_persoana VARCHAR2 (30), banca VARCHAR2 (30), suma NUMBER (9)); 2.introducere date INSERT INTO banci VALUES (1, 'Popescu', 'BCR', 100) INSERT INTO banci VALUES (2, 'Popa', 'BRD', 250) INSERT INTO banci VALUES (3, 'Popescu', 'BRD', 350) INSERT INTO banci VALUES (4, 'Marcu', 'BCR', 570) INSERT INTO banci VALUES (5, 'Popa', 'Raiffeisen', 125) 3. persoane care s-au imprumutat de la mai multe banci si suma totala SELECT nume_persoana, sum (suma) FROM banci GROUP BY nume_persoana HAVING COUNT (banca)>1; 4.bancile care au imprumutat x persoane SELECT banca FROM banci GROUP BY banca HAVING COUNT (nume_persoana)>=1; **Subiectul 4 1. creare tabel CREATE TABLE produse (denprodus VARCHAR2 (15), pretunit NUMBER (10), cantitate N UMBER (10)); 2. introducere date INSERT INTO produse VALUES ('lapte', 25, 5) INSERT INTO produse VALUES ('apa', 15, 10) INSERT INTO produse VALUES ('paine', 8, 25) INSERT INTO produse VALUES ('lapte', 37, 10) INSERT INTO produse VALUES ('paine', 10, 20) 3. afisarea celui mai ieftin produs SELECT denprodus FROM produse WHERE pretunit=(SELECT min(pretunit) FROM produse);

4. calculul costului cantitatii totale a unui produs SELECT sum(pretunit*cantitate) FROM produse WHERE denprodus=:x; **Subiectul 5 1.creare tabel CREATE TABLE materiale (denmat VARCHAR2 (20), pretunit NUMBER (5), unitmas VARCH AR2 (5), cantitate NUMBER (10)); 2. introducere date INSERT INTO materiale VALUES ('ciment', 20, 'kg', 200) INSERT INTO materiale VALUES ('bca', 10, 'buc', 1500) INSERT INTO materiale VALUES ('caramida', 5, 'buc', 2000) INSERT INTO materiale VALUES ('ciment', 25, 'kg', 100) INSERT INTO materiale VALUES ('caramida', 7, 'buc', 500) 3. cautare dupa denumire si pret SELECT * FROM materiale WHERE denmat=:x AND pretunit=:y; 4. costul cantitatii totale a unui material SELECT sum(pretunit*cantitate) FROM materiale WHERE denmat=:x; **Subiectul 6 1.creare tabel CREATE TABLE judete (numejud VARCHAR2 (10), populatie NUMBER (10), suprafata NUM BER (5)); 2. introducere date INSERT INTO judete VALUES ('constanta', 2000000, 20000) INSERT INTO judete VALUES ('ialomita', 1000000, 10000) INSERT INTO judete VALUES ('brasov', 1500000, 15000) INSERT INTO judete VALUES ('dolj', 500000, 10000) INSERT INTO judete VALUES ('cluj', 1400000, 15000) 3. judetele in ordine alfabetica SELECT * FROM judete ORDER BY numejud; 4. descrescator dupa populatie --- nu a mers SELECT *

FROM judete ORDER BY populatie DESC; **Subiectul 7 1.creare tabel CREATE TABLE judete (numejud VARCHAR2 (10), populatie NUMBER (10), suprafata NUM BER (5)); 2. introducere date INSERT INTO judete VALUES ('constanta', 2000000, 20000) INSERT INTO judete VALUES ('ialomita', 1000000, 10000) INSERT INTO judete VALUES ('brasov', 1500000, 15000) INSERT INTO judete VALUES ('dolj', 500000, 10000) INSERT INTO judete VALUES ('cluj', 1400000, 15000) 3.total populatie SELECT SUM (populatie) FROM judete; 4.crescator dupa densitate SELECT numejud, populatie/suprafata AS "densitate" FROM judete ORDER BY densitate DESC; **Subiectul 8 1.creare tabel CREATE TABLE admitere (nume VARCHAR2 (10), prenume VARCHAR2 (10), notarom NUMBER (5,2), notamat NUMBER (5,2), media NUMBER (5,2)); 2.introducere date INSERT INTO admitere (nume, prenume, VALUES ('Marcu', 'Emilia', 9, 10) INSERT INTO admitere (nume, prenume, VALUES ('Anghel', 'Alin', 9, 9) INSERT INTO admitere (nume, prenume, VALUES ('Pop', 'Geo', 10, 10) INSERT INTO admitere (nume, prenume, VALUES ('Dumitru', 'Elena', 9, 9) INSERT INTO admitere (nume, prenume, VALUES ('Dragu', 'Magda', 10, 8) 3.calcul medie UPDATE admitere SET media=(notarom+notamat)/2; 4.lista in ordine descrescatoare dupa medie SELECT * FROM admitere ORDER BY media DESC; notarom, notamat) notarom, notamat) notarom, notamat) notarom, notamat) notarom, notamat)

**Subiectul 9 1.creare tabel CREATE TABLE angajati (cod_anagajat NUMBER (4), nume_angajat VARCHAR2 (25), depa rtament VARCHAR2 (20), salariu NUMBER (6)); 2.introducere date INSERT INTO angajati VALUES (101, 'Popescu Marin', 'contabilitate', 3500) INSERT INTO angajati VALUES (102, 'Marinescu Alina', 'secretariat', 2000) INSERT INTO angajati VALUES (103, 'Alecu Ionut', 'management', 3500) INSERT INTO angajati VALUES (104, 'Bart Elena', 'contabilitate', 2500) INSERT INTO angajati VALUES (105, 'Cojocar Emilia', 'secretariat', 1500) 3.nr de angajati din fiecare departament SELECT departament, COUNT (nume_angajat) FROM angajati GROUP BY departament; 4.salariu mediu pe firma SELECT AVG (salariu) FROM angajati; **Subiectul 10 1.creare tabel CREATE TABLE angajati (cod_anagajat NUMBER (4), nume_angajat VARCHAR2 (25), depa rtament VARCHAR2 (20), salariu NUMBER (6)); 2.introducere date INSERT INTO angajati VALUES (101, 'Popescu Marin', 'contabilitate', 3500) INSERT INTO angajati VALUES (102, 'Marinescu Alina', 'secretariat', 2000) INSERT INTO angajati VALUES (103, 'Alecu Ionut', 'management', 3500) INSERT INTO angajati VALUES (104, 'Bart Elena', 'contabilitate', 2500) INSERT INTO angajati VALUES (105, 'Cojocar Emilia', 'secretariat', 1500) 3.valoarea totala a salariilor pe fiecare departament SELECT departament, SUM (salariu) FROM angajati GROUP BY departament; 4.angajatii cu cel mai mare salariu din firma si departamentul unde sunt angajat i SELECT nume_angajat, departament FROM angajati WHERE salariu=(SELECT max (salariu) FROM angajati); **Subiectul 11

1.creare tabel CREATE TABLE actionari (nume VARCHAR2 (30), serialn NUMBER (8), seriasf NUMBER ( 8), valoare NUMBER (8)); 2.introducere date INSERT INTO actionari VALUES ('Popescu Marin', 1201, 1300, 10) INSERT INTO actionari VALUES ('Marinescu Alina', 2550, 2600, 20) INSERT INTO actionari VALUES ('Alecu Ionut', 1371, 1400, 15) INSERT INTO actionari VALUES ('Bart Elena', 1401, 1500, 10) INSERT INTO actionari VALUES ('Cojocar Emilia', 1501, 2000, 20) 3.suma necesara pt plata tuturor dividendelor SELECT SUM((seriasf-seriain +1)*valoare) FROM actionari; 4.intervalele seriilor actiunilor unui actionar x SELECT nume, seriain, seriasf FROM actionari WHERE nume=:x; **Subiectul 12 1.creare tabel CREATE TABLE plati (nume VARCHAR2 (30), asoc_loc VARCHAR2(30), suma NUMBER (6), suma_restanta NUMBER (6)); 2.introducere date INSERT INTO plati VALUES ('Anghel Emil', '765', 120, 70) INSERT INTO plati VALUES ('Ungureanu Ana', '765', 130, 0) INSERT INTO plati VALUES ('Iordan George', '765', 85, 0) INSERT INTO plati VALUES ('Munteanu Ion', '765', 250, 100) INSERT INTO plati VALUES ('Ene Anca', '765', 150, 100) 3.listarea locuitorilor care nu au restante, alfabetic SELECT nume, asoc_loc FROM plati WHERE suma_restanta=0 OREDER BY asoc_loc, nume; 4.locuitorii cu cea mai mare restanta SELECT nume, asoc_loc FROM plati WHERE suma_restanta=(SELECT MAX(suma_restanta) FROM plati); **Subiectul 13 1.creare tabel CREATE TABLE avioane (pilot VARCHAR2 (30), nr_loc NUMBER(3), data_p DATE, ruta V

ARCHAR2 (30)); 2.introducere date INSERT INTO avioane VALUES ('Anghel Emil', 200, TO_DATE ('10 04 2010', 'DD MM YYYY'), 'Bucuresti-Ias i') INSERT INTO avioane VALUES ('Ungureanu Lucian', 200, TO_DATE ('09 03 2010', 'DD MM YYYY'), 'Bucurest i-Roma') INSERT INTO avioane VALUES ('Anghel Emil', 350, TO_DATE ('14 04 2010', 'DD MM YYYY'), 'Bucuresti-Par is') INSERT INTO avioane VALUES ('Iordan George', 150, TO_DATE ('14 04 2010', 'DD MM YYYY'), 'Bucuresti-C onstanta') INSERT INTO avioane VALUES ('Iordan George', 200, TO_DATE ('15 04 2010', 'DD MM YYYY'), 'Constanta-B ruxelles') 3.nr de piloti angajati SELECT count (DISTINCT pilot) FROM avioane; 4.rutele pt un pilot SELECT ruta, pilot FROM avioane WHERE pilot=:x; **Subiectul 14 1.creare tabel CREATE TABLE studenti (nume VARCHAR2 (30), an NUMBER(1), medias1 NUMBER (5,2), m edias2 NUMBER (5,2)); 2.introducere date INSERT INTO studenti VALUES ('Iordan Eugen', 2, 7.85, 8.25) INSERT INTO studenti VALUES ('Enescu Ana', 2, 8.25, 8.75) INSERT INTO studenti VALUES ('Dinu Elena', 3, 6.25, 7.50) INSERT INTO studenti VALUES ('Munteanu Liliana', 3, 8.75, 9.15) INSERT INTO studenti VALUES ('Leontescu Alin', 2, 7.25, 8.75) 3.nr de studenti din fiecare an SELECT an, COUNT (nume) FROM studenti GROUP BY an; 4.pt 'x' sa se afiseze situatia scoalara SELECT * FROM studenti WHERE nume=:x; **Subiectul 15

1.creare tabel CREATE TABLE rez (nume VARCHAR2 (30), clasa NUMBER(2), punctaj NUMBER (3), judet VARCHAR2 (20)); 2.introducere date INSERT INTO rez VALUES ('Mocanu Anca', 9, 200, 'Constanta') INSERT INTO rez VALUES ('Tudor Andrei', 9, 300, 'Olt') INSERT INTO rez VALUES ('Teodorescu Mirela', 10, 400, 'Constanta') INSERT INTO rez VALUES ('Zenoveanu Felicia', 10, 300, 'Calarasi') INSERT INTO rez VALUES ('Iovan Horia', 11, 500, 'Olt') 3.ordinea descrescatoare a punctajului SELECT * FROM rez ORDER BY punctaj DESC; 4.pt judetul 'x' sa se afiseze punctajul total SELECT SUM(punctaj) FROM rez WHERE judet=:x; **Subiectul 16 1.creare tabel CREATE TABLE angajati ( nume VARCHAR2 (30), sectia VARCHAR2 (8), varsta NUMBER ( 2), nr_copii NUMBER (2)); 2.introducere date INSERT INTO angajati VALUES('Mocanu Anca', 'Filatura', 42, 2) INSERT INTO angajati VALUES('Tudor Andrei', 'Mecanica', 54, 1) INSERT INTO angajati VALUES('Teodorescu Mirela', 'Admin', 22, 0) INSERT INTO angajati VALUES('Zenoveanu Felicia', 'Filatura', 33, 1) INSERT INTO angajati VALUES('Iovan Horia', 'Admin', 41, 0) 3.angajatii cu copii, ordonati alfabetic dupa nume SELECT * FROM angajati WHERE nr_copii>0 ORDER BY nume; 4.informatii despre un angajat 'x' SELECT * FROM angajati WHERE nume=:x; **Subiectul 17 1.creare tabel

CREATE TABLE magazine ( denum VARCHAR2 (30), adresa VARCHAR2 (30), produs VARCHA R2(30), cant_vand NUMBER (3)); 2.introducere date INSERT INTO magazine VALUES('Orsay', 'City Mall', 'curea', 3) INSERT INTO magazine VALUES('Orsay', 'City Mall', 'pantalon', 5) INSERT INTO magazine VALUES('Leonardo', 'City Mall', 'curea', 5) INSERT INTO magazine VALUES('Leonardo', 'TOM', 'pantofi', 5) INSERT INTO magazine VALUES('Puma', 'City Mall', 'pantalon', 3) 3.produsele distincte in ordine alfabetica SELECT DISTINCT produs FROM magazine ORDER BY produs; 4.pt 'x' sa se afiseze denumirea si adresa SELECT denum, adresa FROM magazine WHERE produs=:x; **Subiectul 18 1.creare tabel CREATE TABLE lucrari ( titlu VARCHAR2 (30), judet VARCHAR2 (30), punctaj NUMBER( 3), premiu NUMBER (1)); 2.introducere date INSERT INTO lucrari VALUES('Marea Neagra', 'Constanta', 100, 1) INSERT INTO lucrari VALUES('Picasso', 'Bucuresti', 98, 2) INSERT INTO lucrari VALUES('Decebal', 'Buzau', 74, 0) INSERT INTO lucrari VALUES('Traian', 'Covasna', 99, 2) INSERT INTO lucrari VALUES('Dunare', 'Constanta', 80, 3) 3.titlul si judetul ordonate descrescator dupa punctaj SELECT titlu, judet FROM lucrari ORDER BY punctaj DESC; 4.pt judet 'x' sa se afiseze titlul lucrarii cu premiu SELECT titlu, premiu FROM lucrari WHERE judet=:x AND premiu>0; **Subiectul 19 1.creare tabel CREATE TABLE concurs (nume VARCHAR2 (30), varsta NUMBER (2), sex VARCHAR2 (1), d ata_inscriere DATE);

2.introducere date INSERT INTO concurs VALUES('Ioana', 18, 'f', TO_DATE ('4/05/2010', 'DD/MM/YYYY')) INSERT INTO concurs VALUES('Manuela', 10, 'f', TO_DATE ('15/04/2010', 'DD/MM/YYYY')) INSERT INTO concurs VALUES('Catalin', 12, 'm', TO_DATE ('16/04/2010', 'DD/MM/YYYY')) INSERT INTO concurs VALUES('Mircea', 13, 'm', TO_DATE ('23/04/2010', 'DD/MM/YYYY')) INSERT INTO concurs VALUES('Ergun', 12, 'm', TO_DATE ('5/04/2010', 'DD/MM/YYYY')) 3.total baieti SELECT COUNT (nume) FROM concurs WHERE sex='m'; 4.nume baieti ce pot forma o pereche cu o fata 'x', unde fata este mai mica cu 2 ani SELECT nume FROM concurs WHERE sex='m' AND varsta=2+(SELECT varsta FROM concurs WHERE nume=:x); **Subiectul 20 1.creare tabel CREATE TABLE masini (marca VARCHAR2 (20), model VARCHAR2 (20), pret NUMBER (6), nr_masini_vandute NUMBER (4)); 2.introducere date INSERT INTO masini VALUES('Dacia', 'Logan', 7000, 200) INSERT INTO masini VALUES('BMW', 'X5', 40000, 5) INSERT INTO masini VALUES('Mercedes', 'CLK', 50000, 7) INSERT INTO masini VALUES('Dacia', 'Duster', 15000, 0) INSERT INTO masini VALUES('BMW', 'X3', 30000, 10) 3.modelul si marca auto pt nici o vanzare SELECT marca, model FROM masini WHERE nr_masini_vandute=0; 4.nr masini vandute pt marca 'x' SELECT SUM (nr_masini_vandute) FROM masini WHERE marca=:x; **Subiectul 21 1.creare tabel CREATE TABLE meteo (data DATE, temperatura NUMBER (2), presiunea_atm NUMBER (3)) ;

2.introducere date INSERT INTO meteo VALUES(TO_DATE ('23/04/2010', 'DD/MM/YYYY'), 20, 750) INSERT INTO meteo VALUES(TO_DATE ('15/04/2010', 'DD/MM/YYYY'), 18, 675) INSERT INTO meteo VALUES(TO_DATE ('14/04/2010', 'DD/MM/YYYY'), 21, 765) INSERT INTO meteo VALUES(TO_DATE ('24/04/2010', 'DD/MM/YYYY'), 19, 700) INSERT INTO meteo VALUES(TO_DATE ('3/05/2010', 'DD/MM/YYYY'), 18, 700) 3.datele ordonate incepand cu cea mai recenta pt temperatura maxima SELECT data FROM meteo WHERE temperatura=(SELECT MAX(temperatura) FROM meteo) ORDER BY data DESC; 4.in cate zile s-a inregistrat presiunea atmosferica peste medie SELECT COUNT (data) FROM meteo WHERE presiunea_atm>(SELECT AVG(presiunea_atm) FROM meteo); **Subiectul 22 1.creare tabel CREATE TABLE spectacole (titlu VARCHAR2 (20), nume_trupa VARCHAR2 (30), durata N UMBER (10)); 2.introducere date INSERT INTO spectacole VALUES('Mica sirena', 'Teatru Tandarica', 50) INSERT INTO spectacole VALUES('Cinci femei', 'Teatru National I L Caragiale', 70) INSERT INTO spectacole VALUES('Flori, filme, fete', 'Teatru Act', 60) INSERT INTO spectacole VALUES('Livada de visini', 'Teatru National I L Caragiale', 50) INSERT INTO spectacole VALUES('Sapte', 'Teatru Mic', 50) 3.spectacolele cu durata cea mai mica, ordonate alfabetic SELECT titlu FROM spectacole WHERE durata=(SELECT MIN(durata) FROM spectacole) ORDER BY titlu; 4.durata totala a spectacolelor SELECT SUM(durata) FROM spectacole; **Subiectul 23 1.creare tabel CREATE TABLE bilete (nr_bilet NUMBER (3), oras VARCHAR2 (20), pret NUMBER (3), n r_vagon NUMBER (5)); 2.introducere date

INSERT INTO bilete VALUES(101, 'Bucuresti', 50, 7) INSERT INTO bilete VALUES(102, 'Brasov', 65, 8) INSERT INTO bilete VALUES(98, 'Oradea', 100, 2) INSERT INTO bilete VALUES(78, 'Bucuresti', 50, 6) INSERT INTO bilete VALUES(77, 'Craiova', 65, 6) 3.destinatiile distincte ordonate alfabetic SELECT DISTINCT oras FROM bilete ORDER BY oras; 4.nr biletelor vandute pt orasul 'Bucuresti' SELECT COUNT(nr_bilet) FROM bilete WHERE oras='Bucuresti'; **Subiectul 24 1.creare tabel CREATE TABLE casete (cod_caseta NUMBER (2), nume_film VARCHAR2 (30), tip VARCHAR 2 (20), an_aparitie NUMBER (4)); 2.introducere date INSERT INTO casete VALUES(1, 'Tango', 'drama', 2007) INSERT INTO casete VALUES(2, 'Tartu fife', 'comedie', 2001) INSERT INTO casete VALUES(3, 'Revizonul', 'comedie', 2001) INSERT INTO casete VALUES(4, 'Hamlet', 'drama', 2006) INSERT INTO casete VALUES(5, 'Blocaj in trafic', 'comedie', 2006) 3.sa se afiseze in ordine alfabetica filmele din cadrul fiecarui tip SELECT nume_film, tip FROM casete ORDER BY tip, nume_film; 4.nr filmelor din fiecare an SELECT COUNT (nume_film), an_aparitie FROM casete GROUP BY an_aparitie; **Subiectul 25 1.creare tabel CREATE TABLE filme(titlu_film VARCHAR2 (30), regizor VARCHAR2 (30), premii VARCH AR2 (20)); 2.introducere date INSERT INTO filme VALUES('Tango', 'Andreas Petrescu', 'Oscar')

INSERT INTO filme VALUES('Tantuffe', 'Andrei Belgrader', ' ') INSERT INTO filme VALUES('Revizonul', 'Dan Pita', 'Oscar') INSERT INTO filme VALUES('Hamlet', 'Laszlo Bocsandi', ' ') INSERT INTO filme VALUES('Blocaj in trafic', 'Dan Pita', ' ') 3.sa se afiseze o singura data titlul filmelor care au luat 'Oscar' SELECT titlu_film FROM filme WHERE premii='Oscar'; 4.numele filmelor regizate de 'Dan Pita' SELECT titlu_film FROM filme WHERE regizor='Dan Pita'; **Subiectul 26 1.creare tabel CREATE TABLE campionat (gazde VARCHAR2 (20), oaspeti VARCHAR2 (20), gol_gazde NU MBER (10), gol_oaspeti NUMBER (10)); 2.introducere date INSERT INTO campionat VALUES('Rapid', 'Dinamo', 2, 2) INSERT INTO campionat VALUES('U. Craiova', 'International', 0, 1) INSERT INTO campionat VALUES('Poli Iasi', 'Gaz Metan Medias', 1, 1) INSERT INTO campionat VALUES('Astra Ploiesti', 'CFR Cluj', 1, 0) INSERT INTO campionat VALUES('F.C. Vaslui', 'Ceahlaul', 1, 0) 3.nr meciurilor cu scor egal SELECT COUNT (gazde) FROM campionat WHERE gol_gazde=gol_oaspeti; 4.meciurile in care au castigat oaspetii SELECT gazde, oaspeti FROM campionat WHERE gol_gazde<gol_oaspeti; **Subiectul 27 1.creare tabel CREATE TABLE jucatori(nume VARCHAR2 (30), echipa VARCHAR2 (30), data_inceperii DATE, data_plecarii DATE, pret NUMBER (5)); 2.introducere date INSERT INTO jucatori VALUES('Gheorghe Hagi', 'Farul', TO_DATE('12.05.1983', 'DD.MM.YYYY'), TO_DATE('2 5.09.1985', 'DD.MM.YYYY'), 2000) INSERT INTO jucatori

VALUES('Mutu Adrian', 'Steaua', TO_DATE('23.04.2000', 'DD.MM.YYYY'), TO_DATE('18 .07.2001', 'DD.MM.YYYY'), 3000) INSERT INTO jucatori VALUES('Gheorghe Hagi', 'Steaua', TO_DATE('10.06.1986', 'DD.MM.YYYY'), TO_DATE(' 29.12.1990', 'DD.MM.YYYY'), 2500) INSERT INTO jucatori VALUES('Banel Nicolita', 'Farul', TO_DATE('23.06.2009', 'DD.MM.YYYY'), NULL, 200 0) INSERT INTO jucatori VALUES('Plesan Mihaita', 'Rapid', TO_DATE('14.10.2009', 'DD.MM.YYYY'), TO_DATE(' 15.04.2010', 'DD.MM.YYYY'), 3000) 3.jucatorii de la fotbal, ordonati alfabetic SELECT nume FROM jucatori WHERE echipa='Farul' AND data_plecarii IS NOT NULL; 4.cat a castigat Gheorghe Hagi in total SELECT SUM(pret) FROM jucatori WHERE nume='Gheorghe Hagi'; **Subiectul 28 1.creare tabel CREATE TABLE emisiuni(titlu VARCHAR2 (30), ora NUMBER (5,2), durata NUMBER (3), data DATE); 2.introducere date INSERT INTO emisiuni VALUES('Pe muchie de cutit', 19.30, 120, TO_DATE('15.09.2008', 'DD.MM.YYYY')) INSERT INTO emisiuni VALUES('Happy Hour', 18.15, 145, TO_DATE('18.06.2009', 'DD.MM.YYYY')) INSERT INTO emisiuni VALUES('Stiri', 19.30, 30, TO_DATE('15.03.2010', 'DD.MM.YYYY')) INSERT INTO emisiuni VALUES('Atlas', 14.30, 30, TO_DATE('15.09.2008', 'DD.MM.YYYY')) INSERT INTO emisiuni VALUES('Te pui cu blondele', 20.00, 75, TO_DATE('15.09.2008', 'DD.MM.YYYY')) 3.nr emisiunilor ce incep la 19.30 SELECT COUNT(titlu) FROM emisiuni WHERE ora=19.30; 4.emisiunile din data de 15.09.2008, ordonate alfabetic SELECT titlu FROM emisiuni WHERE data=TO_DATE('15.09.2008', 'DD.MM.YYYY') ORDER BY titlu; **Subiectul 29 1.creare tabel CREATE TABLE orase(nume VARCHAR2 (30), nr_locuitori NUMBER (10), anul_atestarii NUMBER (4)); 2.introducere date

INSERT INTO orase VALUES('Bucuresti', 500000, 1500) INSERT INTO orase VALUES('Constanta', 200000, 1460) INSERT INTO orase VALUES('Mangalia', 100000, 1460) INSERT INTO orase VALUES('Cernavoda', 10000, 1750) INSERT INTO orase VALUES('Brasov', 500000, 1460) 3.orasele cu cei mai multi locuitori SELECT nume FROM orase WHERE nr_locuitori=(SELECT MAX(nr_locuitori) FROM orase); 4.cel mai vechi oras SELECT nume FROM orase WHERE anul_atestarii=(SELECT MIN(anul_atestarii) FROM orase); **Subiectul 30 1.creare tabel CREATE TABLE vinuri(nume VARCHAR2 (30), anul NUMBER (4),tipul VARCHAR2 (10), pro ducator VARCHAR2 (30), pret NUMBER (5,2)); 2.introducere date INSERT INTO vinuri VALUES('Muscat Otonel', 2008, 'sec', 'Murfatlar', 6.50) INSERT INTO vinuri VALUES('Feteasca Regala', 2009, 'dulce', 'Jidvei', 11.00) INSERT INTO vinuri VALUES('Muscat Otonel', 2009, 'sec', 'Jidvei', 7.80) INSERT INTO vinuri VALUES('Feteasca Regala', 2008, 'dulce', 'Panciu', 13.50) INSERT INTO vinuri VALUES('Feteasca Regala', 2008, 'dulce', 'Murfatlar', 10.00) 3.pretul mediu pt 'Feteasca Regala' SELECT AVG (pret) FROM vinuri WHERE nume='Feteasca Regala'; 4.vinurile seci din 2008, ordonate alfabetic SELECT nume FROM vinuri WHERE tipul='sec' AND anul=2008 ORDER BY nume;