Académique Documents
Professionnel Documents
Culture Documents
VIEW
CREATE VIEW S6_3 as
SELECT TOP (100) PERCENT Nume,Salariu
FROM Colaborator
WHERE Departament = 'Contabilitate'
ORDER BY Salariu DESC, Nume
--
CREATE VIEW S6_4 as
SELECT TOP (100) PERCENT Nume,
DATEDIFF (year, DataInceput, GETDATE()) as Vechime
FROM Colaborator
ORDER BY Vechime
--
ALTER VIEW S6_4 as
SELECT TOP (100) PERCENT Nume,
DATEDIFF (year, DataInceput, GETDATE()) as Vechime,
CASE
WHEN DATEDIFF (year, DataInceput, GETDATE())>=10 THEN 0.1
WHEN DATEDIFF (year, DataInceput, GETDATE())<10
AND DATEDIFF (year, DataInceput, GETDATE())>=5 THEN 0.05
ELSE 0
END AS SporVechime
FROM Colaborator
ORDER BY Vechime
--
CREATE VIEW S6_6 as
SELECT AVG(DATEDIFF (year, Data_Nasterii, GETDATE())) as VarstaMedie
FROM Colaborator
WHERE Departament = 'Contabilitate'
--
ALTER TABLE Nume Tabel CREATE TRIGGER Nume CREATE VIEW Nume AS
ADD CONSTRAINT Nume ON Tabel SELECT Tabel, Functie
Cerinta FOR INSERT FROM Tabel
AS WHERE Ce se Cere
CHECK Ce ni se cere IF EXISTS (SELECT * FROM GROUP BY Nume, departament etc
INSERTED WHERE Ce se cere) HAVING Ce sa contina
BEGIN
RAISERROR
('Atentie!',10,10) CREATE VIEW Nume AS
ALTER TABLE Nume Tabel END SELECT TOP (100) PERCENT
ADD CONSTRAINT Nume Nume,Salariu
Cerinta FROM Tabel
FOREIGN KEY (Tabel) WHERE Departament =
REFERENCES 'Contabilitate'
Tabel(Continut) ORDER BY Salariu DESC, Nume