Last answered:

16 Nov 2023

Posted on:

02 Nov 2021

1

Can you show the instructions to reproduce dept_manager_dup table?

In this lesson, we refere to a duplicate of dept_manager_table name dept_manager_dup.
It includes null values and some new inserted values compared to the original dept_manager table.

Not sure if this was part of a previous exercise, but I don't recall having to create and modify the dept_manager_dup table.
Can you show the instructions to re-create this duplicate table with the null values and new content if any?

Thanks.

Francois

4 answers ( 0 marked as helpful)
Instructor
Posted on:

15 Dec 2021

1

Hi Francois!

Thanks for reaching out.

The duplicate table should be the same. So, the code for inserting records in the duplicate table is:

INSERT INTO departments_dup
(
   dept_no,
   dept_name
) 
SELECT
*
FROM
departments;

Hope this helps.
Best,
Tsvetelin

Posted on:

11 Nov 2022

2

This is for the wrong table. He's referred to the dept_manager table not the departments table. In Section 8, the code loaded in for the dept_manager table involves Not Null constraints for all fields

Posted on:

01 Feb 2023

0

The dept_manager_dup creation is in the previous "Excerise" Section. You need to scroll the on-screen text to see "Task 2"

Posted on:

16 Nov 2023

0

Hi Francois you can copy the code below to produce the dept_manager_dup table.


INSERT INTO
 dept_manager_dup
 ( emp_no,
 dept_no,
 from_date,
 to_date )
 
SELECT*FROM
dept_manager;


INSERT INTO

                 dept_manager_dup
SELECT * FROM

               dept_manager;


INSERT INTO dept_manager_dup (emp_no, from_date)
VALUES                (999904, '2017-01-01'),
                            (999905, '2017-01-01'),
                            (999906, '2017-01-01'),
                            (999907, '2017-01-01');


DELETE FROM dept_manager_dup
WHERE
    dept_no = 'd001';


INSERT INTO departments_dup (dept_name)
VALUES               ('Public Relations');


DELETE FROM departments_dup
WHERE
    dept_no = 'd002';

Submit an answer