Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
exp7
--Sql Server 2014 Express Edition --Batches are separated by 'go' create table emp(emp_no integer,emp_name varchar(20),dept_no integer ,dept_name varchar (20),salary integer,hiredate date); insert into emp values(1,'Jay',11,'sales',50000,'2012-09-25'),(2,'ashish',11,'sales',15000,'2003-07-22'),(3,'shreyas',10,'it',30000,'2000-11-05'),(4,'priya',15,'production',45000,'2010-04-15'),(7,'mona',15,'production',35000,'2010-10-05'); select * from emp; create table dept(dept_no integer,location varchar(30)); insert into dept values(11,'mumbai'),(10,'thane'),(15,'kalyan'),(16,'marketing'); select * from dept; select * from emp where salary>(select avg(salary) from emp); select emp_no,emp_name,dept_name,location from emp left outer join dept on emp.dept_no=dept.dept_no where dept_name='sales'; select max(salary) as max_salary,min(salary) as min_salary from emp; select emp_no,salary,emp.dept_no,location from emp left outer join dept on emp.dept_no=dept.dept_no where dept_name='production'; select emp_no,emp_name,format(hiredate,'MMM-dd-yyyy')as hiredate from emp ; select datediff(day,(select hiredate from emp where emp_name='ashish'),(select hiredate from emp where emp_name='shreyas'));
run
|
edit
|
history
|
help
0
Combined Where and having
Pana la ex 7, inclusiv
Stored procedure
joins
9.12.2020
product_sales
MS SQL Joins
db6
mc170403050
Comercio