CREATE TABLE Student
(
NrM int,
Nume varchar(20),
Grupa varchar(5),
Medie number,
Bursa float
);

INSERT INTO Student VALUES (1, 'Tapus Radu', '331CA', 9.9, 0);
INSERT INTO Student VALUES (2, 'Popescu Costel', '333CB', 6.9, 0);
INSERT INTO Student VALUES (3, 'Ion Ionel', '331CA', 8.6, 0);
INSERT INTO Student VALUES (4, 'Badea Gheorghe', '331CA', 9.3, 0);
INSERT INTO Student VALUES (5, 'Mendeleev Viorica', '331CA', 5.4, 0);

SELECT * FROM Student;

PROMPT 'Nume: ';
ACCEPT nume char;

PROMPT 'Grupa: ';
ACCEPT grupa char;

PROMPT 'Medie: ';
ACCEPT medie number;

INSERT INTO Student VALUES (6, '&nume', '&grupa', &medie, 0);

SELECT * FROM Student;

DEFINE suma = 'SELECT SUM (Medie) FROM Student';

PROMPT 'Fond Bursa: ';
ACCEPT fond number;

DEFINE pct = (&fond / (&suma));

UPDATE Student
SET bursa = Medie * (&fond / (&suma));

SELECT * FROM Student;

DEFINE suma2 = 'SELECT SUM (Medie) FROM Student WHERE Medie >= 7'

UPDATE Student
SET bursa = 0
WHERE Medie < 7;

UPDATE Student
SET bursa = Medie * (&fond / (&suma2))
WHERE Medie >= 7;

SELECT * FROM Student;  

DROP TABLE Student;