Question: Problem 1 ( 2 0 points ) Create a MidT.sql script for SQL Server to create an exam 1 en database containing two tables described
Problem points
Create a MidT.sql script for SQL Server to create an examen database containing two
tables described below:
"Departments" table with columns: "DeptId" INT NOT NULL and
"Name" VARCHAR NOT NULL;
"MgrId" INT
"Employees" table with columns: "EmpId" INT NOT NULL,
"Name" VARCHAR NOT NULL,
"Age" INT NOT NULL,
"Salary" DECIMAL NOT NULL,
"DeptId" INT NOT NULL;
The primary key of the "Departments" table is "DeptId" and the primary key of the
"Employees" table is "EmpId".
In addition, the attribute "DeptId" in the "Employees" table is a foreign key that
references the attribute "DeptId" of the "Departments" table. This foreign key must not
allow us to delete a department if there are employees assigned to that department.
However, updates in Department table DeptId must be propagated to the Employees
table.
The attribute "MgrId" in the "Departments" table is a foreign key that references the
attribute "EmpId" of the "Employees" table. This foreign key must not allow us to delete
an employee if this employee is the manager of a department. This foreign key must
also prevent updating the "EmpId" of a department manager.
Your MidT.sql script must also insert the following data at a minimum:
Collge LaSalle of
Department 'Marketing', ;
Department 'Accounting', ;
Department 'Finance', ;
Department IT;
Employees 'Mary', ;
Employees 'John', ;
Employees 'Brian', ;
Employees 'Anne', ;
Employees 'James', ;
Run your script to create this database and its tables.
Problem points
Create a tiers C# Windows Form, ADO.NET application with two options at the
main menu of the window for:
Showing a DataGridView adapted for the "Employees" table, which allows you to see
the data in the table, add new rows, modify rows and delete them deleting several
rows Use SQLAdaper.
Showing a DataGridView adapted for the "Departments" table, which allows you to
see the data in the table, add new rows, modify rows and delete them deleting several
rows Use SQLAdaper.
Note: To correctly handle the deletion of multiple rows in the case of restriction by the
foreign key, the same foreign key must be defined between the DataTables. Therefore,
both DataTables must be loaded in memory before using any of these two tables for the
first time.
Problem points
Include in your solution two business rules:
no employee can be less than years old nor older than years.
no employee can have a salary lower than or equal to Can$
In case of violation of these rules, messages must be specific and the insertion or
update must be rejected.
Create a Word or PDF file with the screen shots showing that your solution executes
correctly.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
