Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Create a schema employee 2 . Write a SQL statement to create a simple table countries including columns country _ id , country

1. Create a schema employee
2. Write a SQL statement to create a simple table countries including columns
country_id,country_name and region_id.
3. Write a SQL statement to create a table named jobs including columns
job_id, job_title, min_salary, max_salary and check whether the max_salary
amount exceeding the upper limit 25000.
4. Write a SQL statement to create a table job_history including columns
employee_id, start_date, end_date, job_id and department_id and make sure
that, the employee_id column does not contain any duplicate value at the time
of insertion and the foreign key column job_id contain only those values which
are exists in the jobs table.
Here is the structure of the table jobs;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| JOB_ID | varchar(10)| NO | PRI |||
| JOB_TITLE | varchar(35)| NO || NULL ||
| MIN_SALARY | decimal(6,0)| YES || NULL ||
| MAX_SALARY | decimal(6,0)| YES || NULL ||
+------------+--------------+------+-----+---------+-------+
5. Write a SQL statement to create a table departments
| Field | Type | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+-------+
| DEPARTMENT_ID | decimal(4,0)| NO | PRI |0||
| DEPARTMENT_NAME | varchar(30)| NO || NULL ||
| MANAGER_ID | decimal(6,0)| NO | PRI |0||
| LOCATION_ID | decimal(4,0)| YES || NULL ||
+-----------------+--------------+------+-----+---------+-------+
6. Write a SQL statement to create a table employees including columns
employee_id, first_name, last_name, email, phone_number hire_date, job_id,
salary, commission, manager_id and department_id and make sure that, the
employee_id column does not contain any duplicate value
at the time of insertion and the foreign key columns combined by
department_id and manager_id columns contain only those unique
combination values, which combinations are exists in the departments
table.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions