You are on page 1of 7

Question #1.

Entity & Attributes


Entity
Student

Instructor

Course
Grade

Academic Result

Attributes
Student ID
Student Name
Student Address
Student Phone
Instructor ID
Instructor Name
Instructor Address
Instructor Phone
Course ID
Course Name
Course Description
Grade ID
Grade Weight
Student ID
Course ID
Academic Term
Instructor ID
Grade ID

Types of database processing:


1. Relationing table (Make A Relationship)
2. Make a form for each table to input, edit, and delete data.
3. Make query about recapitulation of student result that consist field:
a. Student ID, Student Name, Student Address, Student Phone for MainQuery
b. Course ID, Course Name, Academic Term, Instructor Name, Grade ID for
DetailQuery
4. Make query to calculate academic standing for each student
5. Make a multi table form to display recapitulation of student result including their
current academic standing
6. Make a report of student result
Application software:
Ms.access 2010 / 2013
Question #2 : The relationship between a superkey,a a candidate key, and a primary key.
A superkey is an attribute or set of attributes that uniquely identifies a tuple within a relation,
then a candidate key is a super key such that no proper subset is a super key within the
relation, finally, primary key is the candidate key that is selected to identify tuples uniquely
within the relation, the candidate keys which are not selected as PKs are called "Alternate
keys".

Primary key
Candidate key
Superkey

Example:
ID
1
2

RollNo
0001
0002

Name
Abraham
Babe

EnrollNo
A001
A002

Address
Jakarta
Delhi

DeptIID
1
2

A Super key is ID, RollNo, EnrollNo (RollNo, and EnrollNo is an alternate keys)
A Candidate Key is ID, RollNo, Enroll No
A Primary Key is ID
Question #3 : own unique example of a supertype/subtype relationship:
Asset entity is the supertype, then inventory, goodwill, account receivable, note receivable,
and patent can be the subtype entities
In Accounting, there is a major part called assets, Assets is a property owned by a person or
company, regarded as having value and available to meet debts, commitments, or legacies.
Inventory, goodwill, account receivable, note receivable, and patent is a property that is
having value and available to meet debts, commitments, or legacies. So, we could say that it
is a part of assets
Question #4 : Describe of Oracle Data dictionary views (At least two)):
1. CODE_PIECES
Oracle accesses this view
USER_OBJECT_SIZE views.

to

create

the

DBA_OBJECT_SIZE

and

Column

Datatype

NULL

Description

OWNER

VARCHAR2(30)

NOT NULL

Owner of the object

NAME

VARCHAR2(30)

NOT NULL

Name of the object

2. ALL_USERS
ALL_USERS lists all users of the database visible to the current user. This view does
not describe the users. See the related views.
Column

Datatype

NULL

Description

USERNAME

VARCHAR2(30)

NOT NULL

Name of the user

USER_ID

NUMBER

NOT NULL

ID number of the
user

CREATED

DATE

NOT NULL

User creation date

Question#5 : own example of a relationship that is in 3rd Normal Form.


There is a Table before normalization, like:
StudentID

StudentName

Anton

Budi

CourseID
CS0192
CS0239
CS0239
CS0983

CourseName
Algebra
Calculus
Calculus
Algorithm

AcademicTerm Grade
A
Odd 2014/2015
B
A
Odd 2014/2015
C

1NF
In 1NF, the repetitive must be separated, then its look like:
StudentID
1
1
2
2
2NF

StudentName
Anton
Anton
Budi
Budi

CourseID
CS0192
CS0239
CS0239
CS0983

CourseName
Algebra
Calculus
Calculus
Algorithm

AcademicTerm
Odd 2014/2015
Odd 2014/2015
Odd 2014/2015
Odd 2014/2015

Grade
A
B
A
C

In 2NF,specifically: a table is in 2NF if and only if it is in 1NF and no non-prime attribute is


dependent on any proper subset of any candidate key of the table. A non-prime attribute of a
table is an attribute that is not a part of any candidate key of the table.
Student Table
Student ID
1
2

StudentName
Anton
Budi

Course Table
CourseID
CS0192

CourseName
Algebra

CS0239
CS0983

Calculus
Alhorithm

Result table
StudentID
1
1
2
2
3NF

CourseID
CS0192
CS0239
CS0239
CS0983

AcademicTerm
Odd 2014/2015
Odd 2014/2015
Odd 2014/2015
Odd 2014/2015

Grade
A
B
A
C

Third normal form is the third step in normalizing a database design to reduce the duplication
of data and ensure referential integrity by ensuring that
1. the entity is in second normal form and
2. all the attributes in a table are dependent on the primary key and only the primary key
Student Table
Student ID
1
2

StudentName
Anton
Budi

Course Table
CourseID
CS0192
CS0239
CS0983

CourseName
Algebra
Calculus
Alhorithm

Result Main Table:


StudentID

Academic
Term
1
Odd
2014/2015
2
Odd
2014/2015
Resuld Detail Table
StudentID
1
1
2
2

CourseID
CS0192
CS0239
CS0239
CS0983

Grade
A
B
A
C

Question#6 : own example of SQL containing one of the following commands: CREATE
CREATE TABLE Student
(
StudentID int NOT NULL PRIMARY KEY,
StudentName varchar(255),
Studentaddress varchar(255),
Studentphone varchar(255),
StudentCity varchar(255)
);
Question#7
A. Create a table with at least 4 attributes one of which is the Primary key.
CREATE TABLE Instructor
(
InstructorID int NOT NULL PRIMARY KEY,
InstructorName varchar(255),
InstructorPhone varchar(255),
InstructorAddress varchar(255)
);
B. Insert 2 records into the table.
INSERT INTO Instructor (InstructorID, InstructorName, InstructorPhone,
InstructorAddress)
VALUES (1,'Donald, P.hd','099-9087','Melbourne 187');
INSERT INTO Instructor (InstructorID, InstructorName, InstructorPhone,
InstructorAddress)
VALUES (2,'Trump, P.hd','099-2387','Canberra 276');
C. Select statement to show the content of your table after the inserts.
Select *
From Instructor;
Question#8 : Stored procedures and triggers and how are they used in database applications?
stored procedure is a group of Transact-SQL statements compiled into a single execution
plan. Stored procedures can also improve performance. Many tasks are implemented as a
series of SQL statements.
How using it:
There are two different ways to execute a stored procedure. The first and most common
approach is for an application or user to call the procedure. The second approach is to set the
procedure to run automatically when an instance of SQL Server starts. When a procedure is
called by an application or user, the Transact-SQL EXECUTE or EXEC keyword is explicitly
stated in the call. Alternatively, the procedure can be called and executed without the
keyword if the procedure is the first statement in the Transact-SQL batch.

Trigger in SQL is a sequence of actions which results in a change in the table of a database.
It is activated when the contents of the table of a database are modified.
How using it:
DDL triggers execute in response to a variety of data definition language (DDL) events.
These events primarily correspond to Transact-SQL CREATE, ALTER, and DROP
statements, and certain system stored procedures that perform DDL-like operations. Logon
triggers fire in response to the LOGON event that is raised when a user sessions is being
established.
Trigger on a CREATE, ALTER, DROP, GRANT, DENY, REVOKE, or UPDATE STATISTICS
statement (DDL Trigger)
CREATE TRIGGER trigger_name
ON { ALL SERVER | DATABASE }
[ WITH <ddl_trigger_option> [ ,...n ] ]
{ FOR | AFTER } { event_type | event_group } [ ,...n ]
AS { sql_statement [ ; ] [ ,...n ] | EXTERNAL NAME < method specifier > [
; ] }
<ddl_trigger_option> ::=
[ ENCRYPTION ]
[ EXECUTE AS Clause ]

You might also like