1) Write a Query to display maximum salary of an employee from the below table
Table name: employee
Table name: employee
| EmpID | Empname | Salary |
| 101 | Naveen | 30000 |
| 102 | Saidesh | 32400 |
| 103 | Eshwar | 26300 |
| 105 | leeladhar | 86345 |
| 106 | vijeth | 10000 |
syntax: SELECT MAX(column_name) FROM table_name;
Query: SELECT MAX(Salary) FROM employee;
output: 86345
2) Write a Query to update the salary of an employee with 59000 for empid 106
Table name: employee
| EmpID | Empname | Salary |
| 101 | Naveen | 30000 |
| 102 | Saidesh | 32400 |
| 103 | Eshwar | 26300 |
| 105 | leeladhar | 86345 |
| 106 | vijeth | 10000 |
Ans:
Syntax:UPDATE <tablename> SET <column=value>
WHERE <somecolumn=somevalue>;
Query: UPDATE employee SET Salary=59000 where Empid=106;
output:
| EmpID | Empname | Salary |
| 101 | Naveen | 30000 |
| 102 | Saidesh | 32400 |
| 103 | Eshwar | 26300 |
| 105 | leeladhar | 86345 |
| 106 | vijeth | 59000 |
No comments:
Post a Comment