Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
new
CREATE TABLE EMP (EMPNO INT, EMPNAME CHAR(20), JOB CHAR(20), HIREDATE CHAR(20), SAL FLOAT, COMM FLOAT, DEPT_NO INT); INSERT INTO EMP (EMPNO,EMPNAME,JOB,HIREDATE,SAL,COMM,DEPT_NO) VALUES (320,'SUMIT KUMAR','ANALYST','14-MARCH-2019',50000,600,48), (322,'GITESH KUMAR','ASSISTANT MANAGER','14-APRIL-2019',40000,400,45), (305,'MUKESH KUMAR','PRESIDENT','10-MARCH-2010',100000,6008,01), (323,'HARSH','ANALYST','14-OCTOBER-2017',45000,1500,09), (329,'HARSHIT','ASSOCIATE ANALYST','14-MARCH-2019',40000,900,89), (31,'ARVIND','HR','14-JUNE-2010',49000,2000,51), (309,'SAJAL','SENIOR ANALYST','14-NOVEMBER-2009',40000,900,69); INSERT INTO EMP (EMPNO,EMPNAME,JOB,SAL) VALUES (325,'NAVEED','CLERK',50000); create table emp2 (address varchar (100) , age int , empno int ); insert into emp2 values ( 'mrt' ,25 , 323 ), ('gzb' , 24 , 31), ('delhi', 25 , 329), ('meerut', 27, 309); select * from emp2; select * from emp; select top 3 sal from emp; select * from emp where job= 'analyst' and sal = (select max (sal) from emp where job = 'analyst'); select * from emp where empno%2=1; select * from emp where sal <=50000 and (job= 'analyst' or job ='HR'); select empname, charindex(' ', empname) from emp; select* from emp where len( empname) <=5 and empname like 'h%'; alter table emp add phoneno bigint; update emp set phoneno=8755228333 where empno= 320; update emp set empname ='tarun' where empno=320 or empno=305; select * from emp; select max(sal) from emp; select max(sal) from emp where sal < ( select max(sal) from emp); select * from emp where sal =(select max(sal) from emp where sal < ( select max(sal) from emp)); select * from emp where job!='hr' and job!= 'analyst';
run
|
edit
|
history
|
help
0
9.12.2020
self join
EXP 8 q2
Miercoles
Cross and outer apply
Quiz
sqlserver
SQL_Joins_RankingFunctions
DDL,DQL,DML
hi