You are on page 1of 38

Jerson V.

Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


LP1 UNIT 1

Name: Jerson V. Nieva

Course, Year & Section: BSIT 3B

Subject: Advanced Database System

Instructor: Ms. Joanalyn A. Mabulac

Directions: Write your answers on a short bond paper.

Part I.

1. In your own opinion, will Database Management be easier or harder to

understand in the future? Provide an explanation for your answer.

- For me I can say that Database Management will be harder to understand in the
future because a lot of update information that will be included in database
management will be implemented and as many as concept about database is added , it
will be hard to sink it or understand all of it.

2. Provide two examples of a DATA.

- Weight

- Employee names

3. Provide two examples of INFORMATION.

- Receipts

- Printed Documents

4. In your own understanding, describe the difference between data and

information.

- For me, Data are the facts that has been collected by the user and it is useless and
we can call it already a INFORMATION if it has been organized, processed and
structured to make it useful.
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


5. A company creates websites using style sheets.

5.1 Identify one item of data that will be used by the company

- Employee names

5.2 Describe how this item of data can become information.

- The data in employee names will be processed by the knowledge of both computer
and human and decision, then it will be sorted and organized and turn into
information.

5.3 Describe the term knowledge.

If we are talking about computer knowledge, this is what the machine or


computer knows including the consisting of rules and facts.

Part II (Effective Data Administration)

A school is planning some outdoor activities for its students. The staff wants to

create a database of how parents can help. The secretary sets up the database table,

see Figure 1, to keep the information.

Question 1: What problems can you foresee in making good use of this information?
Suggest some better ways that this information could be stored.

- The problem is that the data (Names) are not sorted alphabetically based on
their last name, so one of the best way to store this easily is to sort first the Names
alphabetically.
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

Question 2: Suggest some better ways that this information could be stored.

Provide an explanation on the modification that you have made.

- The table showed below is my idea to sort the information alphabetically based
on their Last Name. Storing it alphabetically can make the user not confused and make
the table organized.

Last Name First Name Phone Contribution Contribution 2

Green Rob 8965431 Transport

Henry James 9576342 Camping Gear Cooking

Smith Jane 4623598 Food Driving


Preparation

Wang Li 9612345 Cooking

TASK 2: Identification

Direction: Read and analyse the questions then supply with the best answer.
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

Across:

1 Basis of Information, Knowledge and Wisdom (DATA)

3 Regarded as 1st Generation DBMS ( APOLLO MOON LANDING)

5 High-level function responsible for security enforcement (SECURITY


MANAGEMENT)

7 Output from Digital BP Machine (MACHINE GENERATED)

9 What a person knows (KNOWLEDGE)

10 A trend in 2000 ( ARTIFICIAL INTELLEGENCE)

11 An administrative process that includes acquiring, validating, etc. (DATA


MANAGEMENT)

Down:

2 A meaning that is being given to a data (INFORMATION)

4 Human-generated Data (EMAILS)

6 Developed Relational Data Model (E.F CODD)

8 Database Management System (DBMS)


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

LP1 UNIT 2
Name: Jerson V. Nieva Instructor: Ms. Joanalyn A. Mabulac

Course & Yr: BSIT 3B Date: ___________________________

Note: Use separate sheet/s (short bond paper) for your answers. This will be retrieved upon
completion.

Task 1

Direction: Consider the customer sales data of a furniture store below and

answer the following questions.

1. What is a data value?

- Data values are what actually take place in the data variable set aside by the
data entities and all its attributes.

2. How many data values does the purchase number 8 have?

-3

3. What is a record?
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


is a collection of fields, possibly of different data types, typically in a fixed
number and sequence

4. How many records does the customer sales data of furniture store have?

- 10

From the data table above, give one example of a record.

8 | /13/06/2019/ | 3 | A_1

5. How many fields does the customer sales data of furniture store have? What

are those?

- 4

-Purchase Number , Date of Purchase , customer ID, Item code.

6. What data value there would be if the customer ID of purchase number 2 is

blank?

- 27

7. When does a violation of relational database model occurs? Give an

example/s.
-Domain constraint gets violated only when a given value to the attribute does not
appear in the corresponding domain or in case it is not of the appropriate datatype.
Assume that the domain constraint says that all the values you insert in the relation
should be greater than 10, and in case you insert a value less than 10 will cause you
violation of the domain constraint, so gets rejected.
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


TASK 2: TRUE or FALSE

Direction: Read the following statements and determine which is TRUE or FALSE.

TRUE 1. The terms row and record can be used interchangeably.

TRUE 2. A NULL value is the same with that of a zero value or a field that contains

spaces.

FALSE 3. The AND, OR, and NOT are all range searching operators.

FALSE 4. Database Management Systems (DBMSes) can handle any amount of data,

from small to large.

FALSE 5. Database optimizers must generate execution plans that reflect the exact

order of operations specified in the SQL statement.

TRUE 6. A database is called “self-describing” because it contains a description of

itself.

TRUE 7. The execution of a query requires the DBMS to break down the query into a

series of independent I/O operations to be executed in a collaborative

manner.

TRUE 8. Structured Query Language (SQL) is an internationally recognized standard

language that is understood by all commercial database management system

products.

FALSE 9. Character data types are usually used for ID numbers such as student

numbers.

TRUE 10. In order to eliminate redundant data in a database, normalization is

performed.
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


TASK 3: Multiple Choice Test

Direction. Choose the letter of the correct answer.

D 1. Which of the following terms does refer to the correctness and completeness
of the data in a database?

a. Data Security

c. Data Constraint

b. Data independence

d. Data Integrity.

C 2. Below are the characteristics of a Relational Table EXCEPT

a. A table is perceived as a two-dimensional structure composed of rows and

columns.

b. Each table row(tuple) represents a single entity occurrence within the entity set.

c. All values in a column may have different data format.

d. Each table column represents an attribute.

A 3. A sports club needs to store information about each member. The individual

information about each member is called a:

a. Field

b. File

c. Table

d. Record

C 4. What does a whole database called?

a. Field

b. File

c. Table
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


d. Record

B 5. A gym has a database with all their members they want to include email
addresses

in the database, what will they do?

a. Add a record

b. Add a field

c. Edit a record

d. Delete a field

D 6. A health club wants to find all the members who use the club 3 days or more a

week. What will they put in the query in the 'days' SQL query criteria?

a. >3

b. <3

c. <=3

d. >=3

B 7. What data type would be used to store the following item code: 0024?

a. Text

b. Integer

c. Real

d. Boolean

A 8. If I am placed between terms I will retrieve data that contain both of the terms.

Which connector am I? Example: candy ____ soda

a. And

b. Or
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


c. Not

d. But

B 9. What is data types?

a. It specifies how many tables you will create when you convert your Entity

Relations Model to a Logical Data Model

b. It specifies what type of data is expected inside of each column in a table (ef.

number, date, string)

c. It counts how many attributes you have

d. It specifies the database-name

A 10. What does the data-type INT contain?

a. Whole numbers

b. Decimal numbers

c. Characters

d. Date

A 11. Which is the correct definition for a field and a record?

a. Fields are single pieces of information and records are a collection of data about a

single person or item

b. Fields are where you put data, records are where you sort data

c. Fields are made of green grass and records contain music

d. Fields are rows, records are columns

D 12. Which are the Boolean operators for less than, greater than and equal to?

a. \ / =

b. { } =
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


c. ( ) ==

d. < > =

A 13. In what stage of query processing does the database server coordinates the

movement of the result set rows from the server cache to the client cache?

a. Fetching

b. Normalization

c. Parsing

d. Execution

C 14. You have a large collection of related data. You want to use a relational database
but

your group member wants to use a spreadsheet. Which of the following would you

share with your group member as an advantage of using databases instead of

spreadsheets?

a. Databases consist simply of worksheets.

b. Databases are easier to learn than spreadsheets.

c. Databases remove the need for redundant data.

d. Only one person can use the same database data at a time.

B 15. Louis will be using his database to support his new web-based trading card
shop.

The database will need to insert, update and delete information about his customers,

the trading cards he buys and sells and orders for the cards themselves. What

language will he use to access and modify the information in his database through

his website?

a. Java

b. SQL
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


c. HTML

d. C++

LP2 UNIT 3
TASK 1: Reflect

Directions: Write your answers on the space provided, you may use a separate paper if
necessary. Do not encode your answers, unless otherwise approved by your subject
instructor.

1. Why would you choose a database system instead of simply storing data in

operating system files? When would it make sense not to use a database system?

Database system is better than just simply storing data in operating system files.
The user can easily sort and organized data using database system. Database system is
more convenient in processing data. There is no reason not to use a database system
actually. But if you are going to store a large data then you have to use rational database
system.

2. The image below show a small portion of a database table recording information
about plants. Along with the botanical and common names of each plant, the developer
decides it would be convenient to keep information on the uses of plant. This is to help
prospective buyers decide whether a plant is appropriate for their requirements. Notice
that the table makes it extremely difficult to answer a question like “What plants are
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


good for firewood?” Using the problem identified, set up a relational database by
creating tables.

Uses

USE 1

USE 2

USE 3

3 . Create a simple database that records the following information of ten students:

Then perform the following queries:

3.1 Create Table

Table name : Students

CREATE TABLE Students

(idnum int NOT NULL,

nameofStudents char(50) NOT NULL,

address char(50) NOT NULL,


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


gender char(50) NOT NULL,

birth_date char(50) NOT NULL,

PRIMARY KEY (idnum)

);

3.2 Insert Into

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘1’ , ’Jerson Nieva’ , ’Maulong’ , ’Male’ , ’July 22 2000 ‘ ;);

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘2’ , ’Mary Jane’ , ’Payao’ , ’Female’ , ’Oct 3 1999 ‘ ;);

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘3’ , ’Aeron Carl’ , ’Sea Wall’ , ’Male’ , ’June 3 2000 ‘ ;);

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘4’ , ’John Patrick’ , ’Slaughterl’ , ’Male’ , ’September 20 1998 ‘ ;);

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘5’ , ’Mikee Rose’ , ’Tarangnan’ , ’Female’ , ’Oct 7 2000 ‘ ;);

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘6’ , ’Charlote Pornias’ , ’Catbalogan’ , ’Female’ , ’March 28 2000 ‘ ;);

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘7’ , ’Kimcoli Docualn’ , ’Maulong’ , ’Male’ , ’January 1 2000 ‘ ;);

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘8’ , ’Mark Acaba’ , ’Maulong’ , ’Male’ , ’February 2 1999 ‘ ;);


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘9’ , ’Steph Lance’ , ’Munoz’ , ’Male’ , ’May 9 2000 ‘ ;);

INSERT INTO Students (idnum, nameofStudents,address,gender,birth_date)

VALUES (‘10’ , ’Shan Balderama’ , ’Maulong’ , ’Male’ , ’November 8 2000 ‘ ;);

4 . What is the evaluation order for the Boolean operations (AND, OR) in an SQL
command? How can one be sure that the operators will work in the desired order
rather than in this prescribed order?

It must be true for both side to have a true result when we are going to use
AND , and it must have only one true to have a result of true when we are going to use
OR. Operators will work in the desired order because the user set it and if the user
ordered the condition correctly.

TASK 2: True or False

Direction: Read the following statements and determine which is TRUE or FALSE.

TRUE 1. CREATE TABLE Category (name VARCHAR (20) PRIMARY KEY);

TRUE 2. A table is composed of row and column

FALSE 3. WHERE Clause specifies selection conditions on tables

TRUE4. SELECT DISTINCT S.sname, S.age FROM Sailors S

TRUE 5. USE database

FALSE6. It is never possible to have a logical error in any of the SQL queries.

FALSE7. The INSERT INTO statement is used to define a new table.


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


FALSE8. A query language is a specialized language for writing queries.

TRUE 9. It is possible to write the INSERT INTO statement in two forms. The first form
does not specify the column names where the data will be inserted, only their values.
The 2nd form specifies both the column names and values to be inserted.

TRUE 10. The DROP statement is used to delete records in a table

TASK 3: Complete the word or Phrase

A B Q T M S P W DX E F O L J Y R U K N H I C Z

4 14 3 20 2 24 10 1 8 2 2 1 1 2 2 9 1 1 6 1 1 1 7 2 1 5
2 6 1 6 3 2 5 9 3 7 1 5 8

DROP DATABASE FROM

CREATE TABLE CREATE DATABASE

DE LETE

WHERE CLA USE

INSERT INTO

USE STATEMENT

AND OR OPERATORS

SELECT
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

LP2 UNIT 4
TASK 1: Matching Type

Direction: Match the statement on the left with the correct answer on the right. You
may write your answer on the space provided before the number.

A 1. Lists the column from base tables or views a. Select Statement

J 2. Used to define wildcards b. Group by

E 3. Used to search for a specified pattern in a column c. Drop Table

I 4. Used to update data in a database d. Order by .

H 5. Single value returned by the previous aggregate function e. Like operator

G 6. Used to return only unique values f. Delete Statement

B 7. Used in conjunction with the aggregate functions

to group result-set by one or more columns g. Distinct

F 8. Used to delete records in a table h. Scalar aggregate

C 9. Deletes all the information about the dropped

relation from the database i. Update

D 10. Sorts the final rows in ASC or DESC j. % sign


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


k. Vector aggregate

L. Vector aggregate

TASK 2: Apply what you have learned

Direction: Using the given table below, perform the needed query and give the

result-set. Write your answer NEATLY in a short bond paper.

1. Which of the following customers are in these cities:

1.1 Catbalogan City;

-Alfred Zamora

-Ana Trujillo Helados


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


- Glydel Pilapil Alarcon

1.2 Jiabong; and

-Bea Abalos Isanan

-Alena Laboc Lourd

1.3 Tarangnan.

-Aiko Calda Uy

2. Add 6 more customers, whose addresses are from the following:

2.1 3 customers coming from Tacloban;

INSERT INTO customers

(CustomerID, CustomerName,ContactName,Address,City,Postal,Country)

Values

(9,’Jerson Nieva’,’Aida Nieva’,’Artemis Mate Extension’,’Tacloban


‘,6500,Philippines );

INSERT INTO customers

(CustomerID, CustomerName,ContactName,Address,City,Postal,Country)

Values

(10,’Lorrenze Nieva’,’Samuel Nieva’,’Artemis Mate Extension’,’Tacloban


‘,6500,Philippines );

INSERT INTO customers

(CustomerID, CustomerName,ContactName,Address,City,Postal,Country)
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


Values

(11,’Joshua Nieva’,’Claire Nieva’,’Artemis Mate Extension’,’Tacloban


‘,6500,Philippines );

2.2 2 customers coming from San Jose de Buan; and

INSERT INTO customers

(CustomerID, CustomerName,ContactName,Address,City,Postal,Country)

Values

(12,’Kimcoli Doculan’,’Aira Doculan’,’Aguingayan’,’San Jose de Buan


‘,6714,Philippines );
INSERT INTO customers

(CustomerID, CustomerName,ContactName,Address,City,Postal,Country)

Values

(13,’Osh Doculan’,’Ivy Doculan’,’Aguingayan’,’San Jose de Buan


‘,6714,Philippines );
INSERT INTO customers

(CustomerID, CustomerName,ContactName,Address,City,Postal,Country)

Values

(14,’Melda Doculan’,’Raffy Doculan’,’Aguingayan’,’San Jose de Buan


‘,6714,Philippines );
2.3 1 customer coming from Basey.

INSERT INTO customers

(CustomerID, CustomerName,ContactName,Address,City,Postal,Country)

Values

(15,’ Leo Nash’,’Steve Nash’,’Brgy Burgos Road’,’Basey‘,6714,Philippines );


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

4. Update the postal code of customers whose address is in Jiabong to 6701.

UPDATE customers

SET Postal = 6701

WHERE City = ‘Jiabong’ ;

5. Arrange the ContactName in ASCENDING ORDER.

SELECT ContactName

FROM customers

ORDER BY ContactName;

5. Which of the following customer whose names ending in letter:

5.1 a;

-Alfred Zamora

-Flora Moreno Taqueria

5.2 n;

-Glydel Pilapil Alarcon

-Barney Berio Hansen

-Bea Abalos Isanan

6. Which of the following customers whose names contain the letters:

6.1 ap;

None

6.2 io; and

- Ana Trujillo Helados

-Flora Moreno Taqueria

-Glydel Pilapil Alarcon


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


-Aiko Calda Uy

-Barney Berio Hansen

-Bea Abalos Isanan

6.3 ou.

-Ana Trujillo Helados

-Aiko Calda Uy

-Alena Laboc Lourd

7. What are the unique cities of the customers?

- Paranas and Calbayog

8. Perform a code that can view customers starting from the 2nd line up to the 5 th

line. You may write two code that may perform the mentioned statement.

SELECT *

FROM customers

WHERE CustomerID >= 2 AND CustomerID <=5 ;


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

LP2 UNIT 5
TASK 1: Testing your understanding

Directions: Write your answers on the space provided, you may use a separate

paper if necessary. Do not encode your answers, unless otherwise approved by

your subject instructor.

1. When is an outer join used instead of a natural join?

The outer join used when we are going to match rows between tables. unmatched rows
in one or both tables can be returned.

2. Explain the following statement regarding SQL: A query that can be written using the
subquery approach can also be written using the joining approach, but not vice-versa.

While SQL*PLUS allows a subquery to return more than one column, most
systems allow pairwise joining of one and only one column in an inner query with one

column in an outer query. You can display data only from the table(s) referenced in the
outer query. If you want to include data from the subquery in the result, then you
would have to use the join technique because data from the subquery cannot be
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


included in the results. The joining technique is useful when data from several relations
are to be retrieved and displayed, and the relationships are not necessarily nested.

3. Under what conditions can a UNION Clause be used?

Union clause can be used when there is a 2 or more result set Select statements to
be combined.

4. Differentiate ALTER, TRUNCATE, DELETE and DROP commands.

Alter modifies the structure of an existing table it can also be used to delete
columns and to add or drop integrity constraints on a table unlike the Truncate
command that deletes the data inside a table, but not the table itself.

Delete command and is used to remove records from a table whereas DROP is
used to remove named elements of schema like table, constraints or entire schema.

TASK 2: Multiple Choice

Direction: Read the questions carefully then choose the best answer. Write the answer

of your choice on the space provided on the left. No erasures.

C 1. What type of join is needed when you wish to include rows that do not have

matching values?

a. Equi-join

b. Natural join

c. Outer join

d. None of the above


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


D 2. What type of join is needed when you wish to return rows that do have matching

values?

a. Equi-join

b. Natural join

c. Outer join

d. All of the above

D 3. Which of the following statement is one of the basic approaches for joining tables?

a. Subqueries

b. Union Join

c. Natural Join

d. All of the above

B 4. The following SQL is a type of join:

SELECT City FROM Customers UNION ALL

SELECT City FROM Suppliers ORDER BY City;

a. Union All

b. Cartesian Join

c. Outer Join

d. Natural Join

C 5. A union query is which of the following?

a. Combines the output from no more than two queries and must include the

same number of columns


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


b. Combines the output from no more than two queries and does not include the

same number of columns

c. Combines the output from multiple queries and must include the same

number of columns

d. Combines the output from multiple queries and does not include the same

number of columns

TASK 3: True or False

Direction: Read the questions carefully. Write T if the statement is TRUE and

write F if the answer is FALSE with the correct statement.

T 1. The UNION clause is used to combine the output from multiple queries

together into a single result table.

F INNER JOIN2. The most frequently used relational operation, which brings together

data from two or more related tables into one resultant table, is

called an equi-join.

F 3. Outer join is the same as equi-join, except one of the duplicate

columns is eliminated in the result table.

T 4. With the UNION clause, each query involved must output the same

number of columns, and they must be UNION compatible.

F INNER QUERY & OUTER QUERY5. A correlated subquery is where the outer query
depends on data From the inner query.
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

LP3 UNIT 6
TASK 1: MULTIPLE CHOICE TEST

Direction: Choose the letter of the correct answer.

A 1. What is the SQL Query to delete all rows in a table without deleting the table

(structure, attributes, and indexes)?

a. DELETE FROM table_name;

c. DELETE TABLE table_name;

b. DROP TABLE table_name;

d. DEL TABLE table_name;

C 2. Which command is used for removing a table and all its data from the database?

a. Create command

c. Drop table command

b. Alter table command

d. All of these

C 3. Which of the following is TRUE concerning a procedure?

a. You do not create them with SQL.

b. They do not need to have a unique name.

c. They include procedural and SQL statements.

d. They are the same thing as a function.

D 4. Which of the following is TRUE concerning systems information in an RDBMS?


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


a. RDBMS store database definition information in system-created tables.

b. This information often cannot be updated by a user.

c. This information can be accessed using SQL.

d. All of these

C 5.

Which of these query will display the the table given above?

a. Select employee from name

c. Select name

b. Select name from employee

d. Select employee

C 6. Here which of the following displays the unique values of the column?

SELECT ________ dept_name

FROM instructor;

a. All

b. From

c. Distinct

d. Name
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

A 7. Which of the following statements is TRUE concerning subqueries?

a. Involves the use of an inner and outer query.

b. Cannot return the same result as a query that is not a subquery.

c. Does not start with the word SELECT.

d. All of these.

A 8. The ______ clause allows us to select only those rows in the result relation of

the ____ clause that satisfy a specified predicate.

a. Where, from

c. From, select

b. Select, from

d. From, where

C 9. The query given below will not give an error. Which one of the following has to

be replaced to get the desired output?

SELECT ID, name, dept name, salary * 1.1

WHERE instructor;

a. Salary*1.1

b. ID

c. Where

d. Instructor

B 10. This Query can be replaced by which one of the following?

SELECT name, course_id

FROM instructor, teaches


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


WHERE instructor_ID= teaches_ID;

a. Select name,course_id from teaches,instructor where instructor_id=course_id;

b. Select name, course_id from instructor natural join teaches;

c.Select name, course_id from instructor;

d. Select course_id from instructor join teaches;

D 11. SELECT * FROM employee WHERE salary>10000 AND dept_id=101;

a. Salary, dept_id

c. Employee

c. Salary

d. All the field of employee relation

D 12.

This is Employee table.

Which of the following employee_id will be displayed for the given query?

SELECT * FROM employee WHERE employee_id>1009;

a. 1009, 1001, 1018

c. 1009, 1018

c. 1001

d. 1018
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

B 13. In the given query which of the keyword has to be inserted?

INSERT INTO employee _____ (1002,Joey,2000);

a. Table

b. Values

c. Relation

d. Field

C 14. SELECT * FROM employee WHERE dept_name="Comp Sci";

In the SQL given above there is an error . Identify the error.

a. Dept_name

b. Employee

c. “Comp Sci”

d. From

A 15.

SELECT name

FROM instructor

WHERE salary <= 100000 AND salary >= 90000;

This query can be replaced by which of the following?

a.

SELECT name

FROM instructor

WHERE salary BETWEEN 90000 AND 100000;

b.

SELECT name
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


FROM employee

WHERE salary <= 90000 AND salary>=100000;

c.

SELECT name

FROM employee

WHERE salary BETWEEN 90000 AND 100000;

d.

SELECT name

FROM instructor

WHERE salary BETWEEN 100000 AND 90000;


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

TASK 2 LET’S PRACTICE

1. Based on the employees table, insert an employee record whose employee_number is


1005, employee_name is Sandra Cruz, salary is P58,000, and dept_id is 500. What would be
the employees table look like?

INSERT INTO employees

(employee_number,last_name,first_name,salary,dept_id)

VALUES (1005,’Cruz’,’Sandra’,58000,500);

employee_nam last_name first_name salary dept_id


e

1001 Salazar John 62000 500

1002 Andoyo Jane 57500 500

1003 Pentero Ben 71000 501

1004 Cabigan Jack 42000 501

1005 Cruz Sandra 58000 500

2. Based on the suppliers table, delete the supplier record whose state is 'California'

and supplier_name is not Google. What would the table look like?

DELETE FROM suppliers WHERE state =’California’ AND supplier_name !=’Google’ ;

supplier_id supplier_name city state

100 Microsoft Redmond Washington

200 Google Mountain View California

400 Kimberly Clark Irving Texas

500 Tyson foods Springdale Arkansas

600 SC Johnson Racine Wisconsin

800 Flower foods Thomasville Georgia


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems

LP3 UNIT 7

TASK 1: MULTIPLE CHOICE!

Direction. Choose the letter of the correct answer.

C 1. What characteristic does NOT mean that data is in 1NF?

a. It is all in one table.

c. There is redundancy.

b. There is an assigned primary key.

d. There are duplicate names.

A 2. What does Normalization allow a database designer to do?

a. Design their database efficiently, removing the chance of redundancy and

inaccuracies.

b. Remove additional records from the tables.

c. Add as much data as they like.

d. Draw an Entity Relationship Diagram

A 3. What is the advantage of Third Normal Form (3NF)?

a. It eliminates redundant data which in turn saves space and reduces manipulation

anomalies.

b. It allows the tables to be queried in SQL.

c. It prevents any new updates.

d. It gives the data status.


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


B 4. One shopper buys many items. How is this expressed as a relationship on an ER

diagram?

a. M:N

b. 1:M

c. M:1

d. 1:1

C 5. Many users access many servers. Why is this statement not a good inclusion in an
ER

diagram?

a. It is not a good idea to access too many servers.

b. It involves a bridging entity.

c. It creates duplicates and therefore redundancy.

d. It is syntactically incorrect.

A 6. An entity is represented by what in a database?

a. Column

b. Cell

c. Row

d. Table

B 7. Which of the following is NOT required for a relational database to meet First
Normal Form?

a. No repeating attributes

c. No repeating groups of data

b. Must meet 2nd normal form

d. Sets of data must have a unique identifier


Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


A 8. Which keys are required to create relationships between entities?

a. Primary key and foreign key

c. Primary key and secondary key

b. Foreign key and domestic key

d. Secondary key and foreign key

A 9. When is a table is said to be Third Normal Form?

a. If and only if it is in 2NF and every non key attribute is Non-transitively

dependent on the primary key.

b. Normalization improves performance by reducing redundancy.

c. It involves introduction of redundancy in data.

d. None of these.

A 10. Which of the following statements fully describes data in 2NF?

a. When all repeating entries of data are removed and the fields in each table are

directly related to the primary key and no fields are present that are not related to

each other.

b. When any repeating fields have been removed and the table is given a primary

key.

c. When all the fields in each table are directly related to the primary key.

d. None of these.
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


TASK 2: TEST

Consider Figure 7.12 of unnormalized data. Farms are visited and a number of

samples are taken from different fields. The number of each species (just Springtail

and Beetle for now) in each sample is recorded. A version of the data is shown in

Figure 7.12)

Answer the following questions:

a. What are some of the updating problems that could occur with the

table in Figure 7.12?

The problem that might occur in this data table is there’s only 1 ID in the 2 farm
Name , so in updating this one , deleting a row or updating or get some changes in the
table might possible be confusing to see or understand by the user.

b. Which of the following functional dependencies hold for the insect

data?

• FarmID → FarmName? YES

• FarmID → Visit? NO

• Visit → Date? YES

• Date → Visit? YES

• Visit → FarmID? NO
Jerson V. Nieva BSIT 3B

Ms. Joanalyn A. Mabulac Advanced Database Sytems


• Sample → Field? YES

• (Sample, VisitID) → Field? YES

• (Sample, Insect) → Count? YES

c. (VisitID, Sample, Insect) → Count? (VisitID, Sample, Insect) is suggested as an


appropriate primary key. Can you determine all the other values from knowing the
values of these three fields? Would it be a suitable primary key?

- FarmID would be a suitable primary key

You might also like