IP SQL Queries
IP SQL Queries
Code-
-- create
salary INT,
DOJ DATE
);
-- insert
-- Query
Output-
2. Write a query to display the position of occurrence of string ‘COUNT’ in string ‘ACCOUNTING’
Code-
select instr('Accounting','count');
Output-
Code-
select upper('empid');
Output-
4. Write a query to delete the column ‘DOJ’
Code-
drop DOJ;
Output-
Code-
Output-
Code-
Output –
7. Write a query to change the location of all employees to ‘Mumbai’ where Department is
‘Accounting’.
Code-
update EMPLOYEE
Output-
8. Write a query to display all records where location is ‘NULL’.
Code-
Output-
9. Write a query to display all employee names whose salary is between 30,000 to 50,000.
Code-
Select distinct(name) from EMPLOYEE where salary between 30000 and 50000;
Output-
10. Write a query to display the records where employee name starts with the letter ‘I’.
Code-
Output-
\
11. Write a query to display records of all employees whose names do not contain the letter ‘E’.
Code-
Output-
12. Write a query to change the data type of the column ‘Salary’ from Integer to Float.
Code-
desc EMPLOYEE;
Output-
13. Write a query to order the table by ‘Salary’ in ascending order.
Code-
order by salary;
Output-
14. Write a query to increase the salary of the ‘Sales’ Department by 10,000.
Code-
Update EMPLOYEE
set salary=salary+10000
where Department='Sales';
Output-
Code-
output-
16. Write a query to display the employee name, department and location of all employees.
Code-
Output-
17. Write a query to display the total number of employees.
Code-
output-
18. Write a query to display the minimum salary being paid within each department.
Code-
group by Department;
Output-
19. Write a query to display the count of employees in each department.
Code-
group by Department;
Output-
20. Write a query to delete all records where the location is not mentioned.
Code-
Output-