21 Jan 18:00
bd - kolos cz.1 7/7
zad 1
CREATE TABLE STUDENCI(
identyfikator INTEGER GENERATED ALWAYS AS IDENTITY(START WITH 1 INCREMENT BY 1),
imie VARCHAR2(40),
nazwisko VARCHAR2(40),
kierunek VARCHAR2(70),
album NUMBER(6) UNIQUE,
srednia NUMBER(3,2),
stypendium INTEGER CONSTRAINT check_stypendium CHECK (stypendium BETWEEN 0 AND 5000),
data DATE CONSTRAINT check_data CHECK(data BETWEEN '2010-01-01' AND CURRENT_DATE),
CONSTRAINT pk_id PRIMARY KEY identyfikator
);
zad 2
INSERT INTO STUDENCI
VALUES ('Roman', 'Romanski', 'Teleinformatyka', 155666, 4.52, 2500, TO_DATE('31-05-2011', 'DD-MM-YYYY'));
INSERT INTO STUDENCI
VALUES ('Tomasz', 'Tomanski', 'Informatyka', 155777, 4.72, 3500, TO_DATE('13-06-2013', 'DD-MM-YYYY'));
INSERT INTO STUDENCI
VALUES ('Marek', 'Lewarek', 'Teleinformatyka', 155456, 4.22, 1700, TO_DATE('18-08-2014', 'DD-MM-YYYY'));
INSERT INTO STUDENCI
VALUES ('Dariusz', 'Mariusz', 'Informatyka', 155654, 4.92, 2700, TO_DATE('12-02-2014', 'DD-MM-YYYY'));
zad 3
SELECT * FROM STUDENCI ORDER BY album ASC;
zad 4
SELECT nazwisko FROM STUDENCI WHERE data BETWEEN TO_DATE('01-01-2015','DD-MM-YYYY') AND TO_DATE('31-12-2020','DD-MM-YYYY');
zad 5
UPDATE STUDENCI SET stypendium = stypendium * 1.25 WHERE kierunek = 'Teleinformatyka';