Question: 1 . Write a SQL statement to create a table named hr _ projects to store the information about the projects being run in the

1. Write a SQL statement to create a table named hr_projects to store the information about the projects being run in the company. Identify to the best of your knowledge proper keys (primary and foreign), the best data types, and any other constraint that should be considered. The table must comprise the following attributes:
project_number: number of the project, it must allow to identify each project uniquely by using this identifier.
project_name: name of the project, it cannot be null.
project_manager: identifies the project manager, it must be one of the existing employees.
project_department: identifies the project department, it must be one of the existing departments.
project_budget: budget of the project (USD currency format).
2. Write a SQL statement to:
Insert yourself as a new employee in the Employees table. Include only your employee_id (1234), last_name (your lastname), email (your email), hire_date (now as in the systems date), and job_id (IT_PROG). Do not include any other information nor NULL values in the insert statement.
Update your salary and set it to 80,000.
Delete yourself from the Employees table (youre fired!).
3. Write a query to show the distinct last names of the employees and how many of them have such same last name, sort the results according to the count first (bigger count first), and in case of equal count then sort according to the alphabetical order (A first, Z last).
4. Write a query to show the full name of the employees in a single column (e.g. John Doe), the department name, and the location (city) for all employees whose job title contains Manager and does not contain Sales.
5. Write a query to show the department name, the departments manager full name in a single column (e.g. John Doe), the average salary of all employees working for the department, and the number of employees of the department. Show only the departments whose managers salary is more than 10,000.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!