Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Zadanie 1
- select ename,
- CASE deptno
- when 20 then 'Sprzedawca'
- when 30 then 'cos tam'
- else 'Pozostali'
- end
- from emp
- Zadanie 2
- select ename,
- (CASE
- when DEPTNO =30 then 'Sprzedarz'
- when DEPTNO = 10 and COMM is null or COMM=0 then 'księgowość bez prowizji'
- when DEPTNO = 10 and COMM is not null and COMM>0 then 'księgowość Z prowizji'
- else 'Pozostali'
- end) as 'Dodatkowa kolumna'
- from emp
- Zadanie 3
- CREATE TRIGGER tworzenie
- ON DATABASE
- FOR CREATE_TABLE
- AS BEGIN
- ROLLBACK
- PRINT 'no nie da sie'
- END
- zadanie 4
- create function srednia (@deptno int)
- returns decimal
- as begin
- declare @srednia decimal
- select @srednia=AVG(sal) from emp where DEPTNO=@deptno
- return @srednia
- end
- select * from emp where sal < dbo.srednia(10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement