100% found this document useful (1 vote)
410 views

Ass

This document provides the details of an assignment to practice SQL skills related to creating and modifying database tables. The assignment involves: 1) Creating four database tables (EMPLOYEE, SKILL, DEPARTMENT, EMP_SKILL) with appropriate field types and constraints. 2) Modifying the EMPLOYEE table by adding an Email field with a unique constraint and setting default values for other fields. 3) Adding a foreign key constraint between EMPLOYEE and DEPARTMENT tables. 4) Removing a field from the EMP_SKILL table. 5) Inserting sample data into the tables and creating a view to filter data from the EMPLOYEE table. The assignment is

Uploaded by

Tuan Pham Quang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
410 views

Ass

This document provides the details of an assignment to practice SQL skills related to creating and modifying database tables. The assignment involves: 1) Creating four database tables (EMPLOYEE, SKILL, DEPARTMENT, EMP_SKILL) with appropriate field types and constraints. 2) Modifying the EMPLOYEE table by adding an Email field with a unique constraint and setting default values for other fields. 3) Adding a foreign key constraint between EMPLOYEE and DEPARTMENT tables. 4) Removing a field from the EMP_SKILL table. 5) Inserting sample data into the tables and creating a view to filter data from the EMPLOYEE table. The assignment is

Uploaded by

Tuan Pham Quang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

CODE: BSQL_Assignment_201

TYPE: n/a

LOC: n/a

DURATION: 180 MINUTES


BSQL Assignment 201
Barem: Each sub-question is 10%.

Objective: H5SD - SQL skills

Problem Description:

In the database design for the Employee Management System of FSOFT Company, given
tables of the application with below:

EMPLOYEE:

EmpNo: employee code, primary key.

EmpName: employee name.

BirthDay: birthday of the employee.

DeptNo: department code of the employee.

MgrNo: manager code, not null.

StartDate: starting date of work.

Salary: salary of the employee, data type is money (VND).

Level: level of the employee (accepts value range from 1 to 7 only).

Status: status of the employee (0: working, 1: unpaid leave, 2: out)

Note: some note about an employee, free text.

EMP_SKILL:

SkillNo: skill code, foreign key.

EmpNo: employee code, foreign key.

SkillLevel: skill level of the employee (accepts value range from 1 to 3 only).

RegDate: registration date.

Description: skill description, free text.

Primary key (SkillNo, EmpNo)

SKILL:

SkillNo: skill code, primary key, auto-increment.

SkillName: name of skill.


Note: some note about skill, free text.

DEPARTMENT:

DeptNo: department code, primary key, auto-increment.

DeptName: department name.

Note: some note about department, free text.

Questions to answer:

Q1:

Create an EMPLOYEE table with the most appropriate/economic field/column


constraints & types. All fields are mandatory except Note field.

Create a SKILL table with the most appropriate/economic field/column constraints &
types, all fields are mandatory except Note field.

Create a DEPARTMENT table with the most appropriate/economic field/column


constraints & types, all fields are mandatory except Note field.

Create EMP_SKILL table with the most appropriate/economic field/column constraints


& types, all fields are mandatory except Description field.

Q2:

Add an Email field to EMPLOYEE table and make sure that the database will not allow
the value for Email to be inserted into a new row if that value has already been
used in another row.

Modify EMPLOYEE table to set default values to 0 of MgrNo and Status fields.

Q3:

Add the FOREIGN KEY constrain of DeptNo field to the EMPLOYEE table that will
relate the DEPARTMENT table.

Remove the Description field from the EMP_SKILL table.

Q4:

Add at least 5 records into each of the created tables.

Create a VIEW called EMPLOYEE_TRACKING that will appear to the user as EmpNo,
Emp_Name and Level. It has Level satisfied the criteria: Level >=3 and Level <= 5.

Estimated Time to complete:180 mins.

-- THE END --

You might also like