EmployeeID | Name | Designation | Experience | Department_ID |
1 | Abhishek | Team Lead | 3.0 | 1 |
2 | Rajesh | Senior HR | 3.0 | 2 |
3 | Suraj | Marketing Manager | 2.5 | 3 |
4 | Ram | System's Engineer | 1.5 | 1 |
5 | Suresh | Executive HR | 2.0 | 2 |
6 | Sanjay | Manager | 3.0 | 4 |
7 | Jacob | Senior Engineer | 2.0 | 1 |
8 | John | Senior HR | 3.5 | 2 |
9 | Arun | Marketing Lead | 2.0 | 3 |
10 | Akshay | Financial Adviser | 1.5 | 4 |
1. Write a query to create a table name “Profession_1” which contains EmployeeID,
Name, Designation, Experience and Department_ID as columns.
2. Import table Profession and Department_ID tables into database and write a query
to show columns Name and Experience from the table “Profession”.
3. Write a query to add a column “DepartmentName” to the table “Profession”.
4. Write a query to update the “DepartmentName” from the table “Department_ID”.
5. Write a query to show the unique DepartmentName and average of Experience of
people corresponding to each DepartmentName from the table “Profession”.
6. Show columns “Name” in Alphabetical order and Experience from the table
“Profession”.
7. Write a query to delete the column “DepartmentName” to the table “Profession”.
8. Change the datatype of the column Experience to decimal in table “Profession”.
9. Insert values “11109”,”Jack”,”Manager”,”6.5”,”4” to the table “Profession”.
10. Update the column Designation to “Senior HR” in table “Profession” whose Name is
“Suresh”.
11. Remove records from the table “Profession” whose experience is greater than 2
years but less than 3 years.
12. Show the records from the table “Profession” whose experience is less than 2 years
and Department_ID=4.
13. Remove all the spaces in the left end in the field “Designation” from the table
“Profession”.
14. Write a query to round off the experience of the persons’ data present in the table
“Profession” to zero decimal places.
15. Create a new table named “Teamlessthan5” from table “Profession” where the
Experience is less than 5.
16. Show Columns “Name”, “Designation” from table “Profession” whose records
EmployeeID are present in the table “Teamlessthan5” by using Joins.
--Make sure that you have the original tables Profession, Department_ID and
Salary_details for the following questions—
17. Create a query to create a foreign key ‘FK_Profession_DepartmentID’.
18. Write a query using joins to show the columns “Name” from table “Profession” and
“Department Names” from the table “Department_ID” whose Department_ID is
present in the column “ID” in the table “Department_ID”
19. Import the table “Salary_details” and write a query to show the following result for
records whose EmployeeID is present in the column ID from the table
“Salary_details”:
EmployeeName Salary
Abhishek 40000
Rajesh 39000
Suraj 33000
Ram 21000
Suresh 26000
Sanjay 41000
Jacob 27000
John 43000
Arun 26500
Akshay 22000
20. Create a new column “Salary” of datatype int and write a query to update the
“Salary” from the table “Salary_details”.
No comments:
Post a Comment
If you Like my blog Spread it and help friends for whom this blog is useful for their career.