0% found this document useful (0 votes)
209 views15 pages

CS351 Database Management Quizzes

This document contains a summary of key concepts in database management systems including: 1. Transactions are units of data that are used to represent something and bring a database from one consistent state to a new consistent state. 2. The overall logical and physical structure of a database is described by schemas which define the underlying structure and relationships between entities. 3. Common statements used for data manipulation include INSERT, UPDATE, DELETE, ALTER which are used to add, modify and remove data from database tables.

Uploaded by

Mark De Guzman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
209 views15 pages

CS351 Database Management Quizzes

This document contains a summary of key concepts in database management systems including: 1. Transactions are units of data that are used to represent something and bring a database from one consistent state to a new consistent state. 2. The overall logical and physical structure of a database is described by schemas which define the underlying structure and relationships between entities. 3. Common statements used for data manipulation include INSERT, UPDATE, DELETE, ALTER which are used to add, modify and remove data from database tables.

Uploaded by

Mark De Guzman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

lOMoARcPSD|6225280

CS351 - Quizes

Database Management System (AMA Computer University)

StuDocu is not sponsored or endorsed by any college or university


Downloaded by Mark De Guzman ([email protected])
lOMoARcPSD|6225280

It is a bundle of actions which are done within Are said to exhibit physical data
a database to bring it from one consistent independence if they do not depend on the
state to a new consistent state. physical schema.

Transaction Application programs


It is a unit of data – is a symbol or a set of It is the term generally used to describe what
symbols which is used to represent was done by large mainframe computers from
something. the late 1940's until the early 1980's.
datum Data Processing
The overall design of the database is called It is a collection of interrelated data and a set
the of programs to access those data.
database schema database-management system (DBMS)
Is the underlying the structure of a database. It is the collection of information stored in the
database at a particular moment is called
data models
instance of the database
The overall logical structure schema of a
database can be expressed graphically by an This describes the database design at the
logical level.
E-R diagram
logical schema
This describes the database design at the
physical level. It is collection of data that contains information
relevant to an enterprise.
physical schema
Database
It is an association among several entities.

relationship It is the collection of basic objects.

This is formed by one or more than one Entities


attributes. This is a characteristic of database that
identifier includes also the protection of the database
from unauthorized access confidentiality and
Are applied to the table and form the logical unauthorized changes.
schema.
Data Integrity
Constraints
It is an interpreted data – data supplied with
It is design to manage large bodies of semantics.
information.
Information
Database systems
This is also known as facts that can be
recorded and that have implicit meaning.

Data

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

He proposed the relational model for An alter statement that is used to add new
database systems in 1970. column to the table.

Dr. E.F Codd ADD

It is a collection of relations or two- An alter statement that is used to delete an


dimensional tables controlled by the Oracle existing column in the table.
server.
DROP
Relational database

A statement that is use to rename the table or


Which of the following is not part of change the existing name of the table.
transaction control?
Rename
CREATE

Basic unit of storage composed of rows and


Which of the following is not part of data columns
manipulation language?
Table
Alter

Which of the following is not true about


Which of the following is not part of data ALTER statement?
control language?
Define a default value for the new column
Insert

Suppose that a user wanted to add a new


An alter statement that is used to update an column name as CITY datatype set to char
existing column datatype or datatype size. size 10. Which of the following is the correct
sql statement?
MODIFY
ALTER TABLE STUDENTS
ADD CITY CHAR(10);
Which of the following datatype is not being
used in oracle?
Suppose that a user wanted to change the
NUMBER datatype of column ADDRESS from Varchar
to Char which of the following is the correct
example.
It logically represents subsets of data from
ALTER STUDENTS
one or more table.
MODIFY ADDRESS VARCHAR(20);
View

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

Which of the following is the correct example Which of the following is the correct example
of dropping the table EMPLOYEES? of modifying the column lastname? Change
the datatype size to 20.
DROP TABLE EMPLOYEES;
ALTER TABLE EMPLOYEES

MODIFY LASTNAME VARCHAR(20);


Which of the following is the correct example
of removing a column FIRSTNAME from
EMPLOYEES table?
Which of the following is the correct example
ALTER TABLE EMPLOYEES of truncating the table EMPLOYEES?

DROP COLUMN FIRSTNAME; TRUNCATE TABLE EMPLOYEES;

Which of the following is the correct example Which of the following is the correct example
of modifying the column JOB_ID? Change the of renaming the table EMPLOYEES to
datatype size to 10. WORKERS?

ALTER TABLE EMPLOYEES RENAME EMPLOYEES TO WORKERS;

MODIFY JOB_ID CHAR(10);

Which of the following is the correct example


of removing a column SALARY from
Which of the following is the correct example EMPLOYEES table?
of adding a new column ADDRESS
datatypevarchar size 20 to EMPLOYEES ALTER TABLE EMPLOYEES
table?
DROP COLUMN SALARY;
ALTER TABLE EMPLOYEES

ADD COLUMN ADDRESS VARCHAR(20);

Which of the following is the correct example


of creating a new table STUDENTS? The
column STUD_ID is set to primary key.

CREATE TABLE STUDENTS( STUD_ID


NUMBER(3) PRIMARY KEY);

Which of the following is the correct example


of adding a new column
CONTACT_NOdatatypeNUMBER size 11 to
EMPLOYEES table?

ADD COLUMN CONTACT_NO


NUMBER(11);

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

Suppose that a user wanted to insert a new Suppose that a user uses the DELETE
value using the implicit method which of the statement as shown below: what is/are the
following is the correct example. possible output.

INSERT INTO STUDENST(USN_ID, 0 rows are deleted.


FIRSTNAME) VALUES(10,’ELENA’)

Suppose that a user wanted to insert a new


A type of insert statement that specify the value using the explicit method which of the
NULL keyword in the VALUES clause. following is the correct example.
Explicit INSERT INTO STUDENTS VALUES (10,
NULL,’ELENA’,NULL);

Consists of a collection of DML statements


that form a logical unit of work. A type of DML statement that is use to update
existing rows in a table.
Transaction
UPDATE

A type of DML statement that is use to remove


existing rows in a table.

DELETE

A type of insert statement that omit the


column from the column list.

Implicit

Suppose that a user wanted to update the


lastname of student to ‘Santos’ and YR_LVL
to ‘Irreg’ whose USN_ID is equal to 50, in one
select statement which of the following is the
correct sql statement to use.

UPDATE STUDENTS

SET LASTNAME = ‘SANTOS’, YR_LVL =


‘IRREG’

WHERE USN_ID = 50;

A type of DML statement that is use to add


new rows in a table.

INSERT

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

Which of the following is the correct example Which of the following is the correct example
of deleting a student record from STUDENTS updating all student COURSE to ‘BSIT’ from
table whose COURSE is equal to NULL; STUDENTS table?

DELETE FROM STUDENTS UPDATE TABLE STUDENTS

WHERE COURSE = ‘NULL’; SET COURSE = ‘BSIT’;

Which of the following is the correct example Which of the following is the correct example
of inserting new values to STUDENTS table of deleting all records in STUDENTS table;
where the course is set to NULL;
DELETE FROM STUDENTS;
INSERT INTO STUDENTS VALUES(1,'DELA
CRUZ','JUANITO',NULL);
Which of the following is the correct example
inserting a new value to STUDENTS table that
Which of the following is the correct example will only add new data to STUD_ID and
of updating the COURSE to ‘N/A’ of all LASTNAME? The stud_id is 10 and lastname
students from STUDENTS table whose is 'CRUZ' and the rest of the column is set to
course IS NULL; NULL.

UPDATE TABLE STUDENTS INSERT INTO STUDENTS VALUES


(10,'CRUZ',NULL,NULL);
SET COURSE = ‘N/A’

WHERE COURSE IS NULL;


Which of the following is the correct example
inserting a new value to STUDENTS table that
Which of the following is the correct example will only add new data to STUD_ID and
updating the student LASTNAME TO LASTNAME? The stud_id is 10 and lastname
‘SANTOS’ and course to ‘BSCS’ whose is ‘CRUZ’
STUD_ID is equal to 109? INSERT INTO
UPDATE TABLE EMPLOYEES STUDENTS(STUD_ID,LASTNAME)

SET LASTNAME = ‘SANTOS’, COURSE = VALUES(10,’CRUZ’);


‘BSCS’

WHERE STUD_ID = 109; Which of the following is the correct example


of inserting new values to STUDENTS table?

Which of the following is the correct example INSERT INTO STUDENTS VALUES(1,'DELA
of updating the LASTNAME to ‘REYES’ of all CRUZ','JUANITO','BSIT');
students from STUDENTS table whose
STUD_ID is equal to 01020564?

UPDATE TABLE STUDENTS

SET LASTNAME = ‘REYES’

WHERE STUD_ID = 01020564;

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

A system used to concatenate one column to


another column.
It is a value that is unavailable, unassigned,
|| unknown, or inapplicable.

NULL

It is a character, a number, or a date that is


included in the SELECT statement.
This is use to Selects the columns in a table
Literal that are returned by a query. Selects a few or
as many of the columns as required.

Projection
Supposed that the user uses the ff SELECT
statement: what will be the possible output.

Error because of missing “” mark.

This is used to selects the rows in a table that


are returned by a query. Various criteria can
be used to restrict the rows that are retrieved.

Selection

This character is used to override the default


precedence or to clarify the statement.

()

This is used to brings together data that is


stored in different tables by specifying the link
between them.
Joins

Which of the following is not true about writing


SQL statements?

Indents should be used to make code more


readable.

This is use to create expression with number


and date values.

Arithmetic expression

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

Which of the following SELECT statement is Which of the following SELECT statement is
the correct PL/SQL that will display all rows the correctreport that will rename the column
and columns? DESCRIPTION to TITLE, PARTNUM to ID
and ONHAND to STOCK?SELECT
SELECT * FROM PARTS; DESCRIPTION AS ‘TITLE’, PARTNUM AS
‘ID’, ONHAND AS ‘STOCK’ FROM PARTS;

Which of the following SELECT statement is


the correct PL/SQL that will displayeliminate
Which of the following SELECT statement is
the duplicate rows for column class and
the correctreport the will merge the column
warehouse.
CLASS and PRICE rename the COLUMN as
SELECT DISTINCT CLASS, WAREHOUSE “CLASS PRICE”.
FROM PARTS;
SELECT (CLASS||PRICE) AS “CLASS
PRICE” FROM PARTS;

Which of the following SELECT statement is


the correct PL/SQL that willcreate a report
specifying only the column PRICE, ONHAND Which of the following SELECT statement is
and DESCRIPTION? the correctreport that will combine the column
PARTNUM and DESCRIPTION put a literal
SELECT PRICE, ONHAND, DESCRIPTION character string “belongs to” in between the
FROM PARTS; two columns then rename the column as
“NUMBER TITLE”. Note put space before and
after the character literal string to avoid no
Which of the following SELECT statement is spaces in the report.
the correct PL/SQL that willcreate a report that SELECT (PARTNUM||’ THAT BELONGS TO
will add 10% increase in PRICE? List only the ’||DESCRIPTION) AS “NUMBER
column DESCRIPTION, CLASS and PRICE. TITLE” FROM PARTS;
SELECT PRICE*0.10, DESCRIPTION,
CLASS FROM PARTS;
Which of the following SELECT statement is
the correctreport that will display the unique
Which of the following SELECT statement is value for WAREHOUSE renames the column
the correct report that will deduct 5 from as “No. of Available Warehouse”.
ONHAND, multiply 5 in WAREHOUSE, after
SELECT DISTINCT WAREHOUSE AS “No.
getting the value on both ONHAND and
of available warehouse” FROM PARTS;
WAREHOUSE add their data: as shown
below: ONHAND - 5 + 5 * WAREHOUSE Note
that you have to force the Oracle to prioritize
first the Subtraction over Multiplication. List Which of the following is the correct report that
only the column DESCRIPTION, ONHAND will display the CLASS from table PARTS.
and WAREHOUSE.
SELECT * CLASS FROM PARTS;
SELECT ONHAND-5 + 5 * WAREHOUSE,
DESCRIPTION FROM PARTS;

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

True/False Character values are format This is used to in conditions that compare one
sensitive and date values are case sensitive- expression with another value or expression.
sensitive.
Comparison
False

Character strings and date values are


This is used to perform wildcard searches of enclosed with double quotation marks.
valid search string values.
False
Like

Which of the following is the correct report that


This is used to restrict the rows that are will display the DESCRIPTION,
returned by a query. WAREHOUSE AND distinct value for CLASS.

Where SELECT DESCRIPTION, WAREHOUSE,


DISTINCT ‘CLASS ‘ FROM PARTS;

This symbol % denotes zero or many


character Which of the following is the correct report
showing all rows and columns sort the
True description in ascending order.

SELECT * FROM PARTS ORDER BY


DESCRIPTION ASC;
This is used to test for values in a specified
set of values.

IN Which of the following is the correct report


listing only the column PARTNUM, CLASS
and ONHAND of all parts where partnum is
This is used to display rows based on a range equal to AT94, DR93 and KV29. (Note 1
of values. query only and do not use logical condition)

Between SELECT PARTNUM, CLASS, ONHAND


FROM PARTS WHERE PARTNUM IN
(‘AT94’,’DR93’,’KV29’);
A null value means that the value is
unavailable, unassigned, unknown, or
inapplicable. Which of the following is the correct report that
will merge the column DESCRIPTION and
True PRICE put a literal character string of = “ with
a price of ” in between the two columns. Limit
the rows returned by getting only the partnum
The != not equal to symbol is also equal to that starts with letter ‘K’.
this symbol<>.
SELECT (DESCRIPTION|| ‘WITH A PRICE
True OF’ || PRICE) FROM PARTS WHERE
PARTNUM LIKE ‘%K’;

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

Which of the following is the correct report where ONHAND is greater than or equal to
listing only the column DESCRIPTION, 21.
PARTNUM, CLASS and PRICE of all parts
where the description fourth letter starting SELECT DESCRIPTION, ONHAND,
from the first is equal to ‘D’. WAREHOUSE FROM PARTS WHERE
ONHAND >=21;
SELECT DESCRIPTION, PARTNUM,
CLASS, PRICES FROM PARTS WHERE
DESCRIPTION LIKE ‘D%’; Which of the following is the correct report
Which of the following is the correct report listing only the column DESCRIPTION,
listing the column PARTNO, DESCRIPTION ONHAND, CLASS and PRICE of all price
and WAREHOUSE. Get only that description where the description ends with letter ‘N’.
that does not ends with ‘ER’. Note that you SELECT DESCRIPTION, ONHAND,
have to merge the said three columns, CLASSS FROM PARTS WHERE
rename the merge column as “Parts Record”. DESCRIPTION LIKE ‘%N’;
Below is the sample output for column.
Parts Record
AT94is the part number ofIRONwhich belong
Which of the following is the correct report
to warehouse3
listing only the column CLASS,
SELECT (PARTNUM || ‘is the part number DESCRIPTION and PRICE of all PARTS
of’ ||DESCRIPTION || ‘which belongs to’ || where price range is between 200 to 500. Sort
WAREHOUSE) FROM PARTS WHERE the Price in descending order.
PARTNUM LIKE ‘%ER’;
SELECT CLASS, DESCRIPTION, PRICE
FROM PARTS WHERE PRICE BETWEEN
200 AND 500;
Which of the following is the correct report
listing only the column DESCRIPTION,
WAREHOUSE, CLASS and PRICE of all parts Which of the following is the correct report that
where the description contains keyword ‘SHE’. will list only the column DESCRIPTION,
SELECT DESCRIPTION, WAREHOUSE, PARTNUM, CLASS, and PRICE of all PART
CLASS, PRICE FROM PARTS WHERE whose CLASS is equal to HW.
DESCRIPTION LIKE ‘%SHE%’; SELECT COLUMN DESCRIPTION,
PARTNUM, CLASS, PRICE FROM PARTS
WHERE CLASS=’HW’;
Which of the following is the correct report that
will display the distinct value for CLASS and
WAREHOUSE limit the rows by getting only Which of the following is the correct report
the parts under WAREHOUSE 3? listing only the column DESCRIPTION,
SELECT CLASS, WAREHOUSE FROM CLASS and PRICE of all PARTS where class
PARTS WHERE WAREHOUSE = 3; is not equal to AP.

SELECT DESCRIPTION, CLASS, PRICE


FROM PARTS WHERE CLASS != AP;

Which of the following is the correct report


listing only the column DESCRIPTION,
ONHAND and WAREHOUSE of all PARTS

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

Which of the following is the correct report


listing only the column PARTNUM,
DESCRIPTION and PRICE of all PARTS
where price is less than 500. Sort the PRICE
in ascending order.

SELECT PARTNUN, DESCRIPTION, PRICE


FROM PARTS WHERE PRICE < 500;

Which of the following is the correct report


listing the DESCRIPTION and Price (Note that
in column PRICE add ADDITIONAL 10000).
Get only the prices with no digit that is equal
to ‘5’. Note that you have to concatenate the
said column and rename the merge column
as “New Price Lists”. Sort the data in DESC
order by Price.

SELECT DESCRIPTION, PRICE + 10000 AS


“NEW PRICE LISTS” FROM PARTS ORDER
BY PRICE DESC;

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

WHERE CLASS = ‘AP’ OR ONHAND


Given the output below. Which of the following
BETWEEEN 8 AND 12
is the correct PL/SQL to be used

SELECT WAREHOUSE, CLASS FROM


PARTS WHERE CLASS IN (‘AP’,’SG’,’HW’);

SELECT DESCRIPTION, ONHAND,CLASS


FROM PARTS
WHERE CLASS = ‘HW’;

Given the output below. Which of the following


is the correct PL/SQL to be used?

SELECT * FROM PARTS;


WHERE DESCRIPTION LIKE ‘%R’;

Given the output below. Which of the following


is the correct PL/SQL to be used? SELECT (PARTNUM|| ‘belong to’||
DESCRIPTION) FROM PARTS WHERE
WHERE CLASS = ‘AP’ OR ONHAND PARTNUM IN (‘BV06,’KV29’)
BETWEEN 8 AND 12;

WHERE DESCRIPTION LIKE ‘%L’;


Given the output below. Which of the following
is the correct PL/SQL to be used?

SELECT DISTINCT WAREHOUSE,


CLASS FROM PARTS WHERE
WAREHOUSE >=1;

SELECT DESCRIPTION, PRICE *.5 +PRICE-


100 FROM PARTS WHERE PRICE >10000;

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

Security is one of the characteristic of Which of the following is not part of handling
database that includes also the protection of data?
the database from unauthorized access
confidentiality and unauthorized changes. Semi-Computerized

False
Which of the following is not part of advantage
of database?
Which of the following is not considered as Database instance
advantage and disadvantage of database?

Transaction
Which of the following is not the main focus
oracle enterprise 11g?
Suppose that the user wanted to add a new Oracle architecture
column name as CUST_NAME data type char
size 6. What is the correct type of statement to
use?
Which of the following is not part of
INSERT disadvantage of database?

Data integrity

Which of the following is not part of basic


SELECT statement
Which of the following is not a characteristic of
Alias database?

Data impendence

Which of the following is not part of


characteristics of database?
Database Management System is a collection
Data Processing of interrelated data and a set of programs to
access those data.

True
Which of the following is not part of DML
statement?

MERGER Which of the following is not part of other


Comparison Operator?

Which of the following is not part of common IS NUL


Comparison operator?

! Which of the following is not a feature of


Oracle 11g?

Which of the following is not part of Data- Robustness


model

Tuple

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

Database Architecture is the overall design of Suppose that the user wanted to add a new
the database column name as CUST_NAME data type char
size 6. What is the correct SQL statement to
False use?

ALTER TABLE PARTS


ADD CUST_NAME CHAR(6);
Which of the following is not part of DDL
statement?

None of the choices UPDATE ORGCHART


SET ORG = ‘PCS’

Which of the following is not the correct WHERE ORG IS NULL;


example of entity? Incorrect WHERE condition must be
=NULL
Phone_no

SELECT NAME, ORG, POSITION


Table is known as the collection of data that
contains information relevant to an enterprise. FROM ORGCHAR
WHERE ORG =’JPCS’
False
OR POSITION = ‘SEC’
AND NAME LIKE ‘%N’;
Database is the term generally used to It will retrieve the record of JOAN and
describe what was done by large mainframe ROAN
computers from the late 1940's until the early
1980's.

False INSERT INTO ORGCHART VALUES


(11,’YAMBAO,JUN’, NULL, NULL);

The ORG and POSITION of YAMBAO will


SELECT NAME, ORG, POSITION, ID * (100 automatically sets to NULL.
+ 3)
FROM ORGCHAR
WHERE ORG = ‘AMATHS’ SELECT NAME, ORG, POSITION

It will retrieve the record of ANNA with new FROM ORGCHAR


ID of 1003 WHERE NAME LIKE ‘A%’
AND POSITION = ‘SEC’;
It retrieves the record of AGAPITO
INSERT INTO ORGCHART (ID, NAME)
VALUES (11,’YAMBAO,JUN’);
The ORG and POSITION of YAMBAO will
automatically sets to None.

Downloaded by Mark De Guzman ([email protected])


lOMoARcPSD|6225280

SELECT NAME, ORG, POSITION


FROM ORGCHAR
WHERE NAME LIKE ‘%A’;
It retrieves the record of ANNA and
MOJICA

SELECT NAME, ORG, POSITION


FROM ORGCHAR
WHERE ORG =’JPCS’
0 rows selected Incorrect SELECT
statement

Downloaded by Mark De Guzman ([email protected])

You might also like