3. DATABASE PLEASE TYPE ANSWER Write the DML for the following: Updating a depar
ID: 3816206 • Letter: 3
Question
3. DATABASE PLEASE TYPE ANSWER
Write the DML for the following:
Updating a department manager.
Inserting a new employee, their salary, title, and department association.
Insert a new department.
Delete an employee.
salaries emp-no INT (10) salary INT(11 from date DATE to date DATE Indexes titles emp no INT(10 title VARCHAR(50) from date DATE to date DATE Indexes employees emp-no INT(10) LH birth date DATE first name VARCHAR(14) last name VARCHAR(16) gender ENUM (M', F) hire date DATE Indexes dept manager dept no CHAR(40 emp no INT(10) from date DATE to date DATE Indexes dept emp emp no INT(10) dept no CHAR(4) from date DATE to date DATE Indexes dept no CHAR(4) dept name VARCHAR(40) IndexesExplanation / Answer
Hi ,
Greetings !!
Please see below step by step DML statemtents,
1. Updating a department manager
UPDATE dept_manager
SET from_date = 20032017 (DDMMYYYY format)
WHERE dept_no = ‘A001’
2. Inserting a new employee, their title, salaries and department association.
New employee inserted with one sample emp_no, which is used in other tables as key and subsequent key values are used in respective tables.
INSERT into employees values (1005233409, 20071988, ‘David’, ‘Warner’, ‘M’, 25102010)
INSERT into salaries (salary, from_date, to_date) values (00000050000, 20102009, 20102040) where emp_no = 1005233409
INSERT into titles (title, to_date) values (‘IT Sector’, 25102020) where emp_no = 1005233409 and from_date = 20102009
INSERT into dept_manager (dept_no, from_date, to_date) values (‘A012’, 20102009, 25102050) where emp_no = 1005233409
INSERT into departments (dept_name) values(‘IT Database’) where dept_no = ‘A012’
3. Inserting a new department
INSERT into departments (dept_no, dept_name) values (‘A124’, ‘John’)
4. Deleting a employee or all rows of table
DELETE from employees where emp_no = 1002478910
DELETE from employees à Delete all rows
Please share your feedback. In case you require more help or any clarification, please put a comment.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.