0% found this document useful (0 votes)
52 views

Single Row Functions

This document contains a quiz for a Database Systems 1 course assessing SQL skills. It provides 4 multiple choice questions asking students to write SQL statements to: 1) create a new email by concatenating parts of first and last names with employee ID, sorted in ascending order; 2) pad a string with asterisks to a certain length; 3) calculate the number of months between two dates; and 4) find the position of a character in a string and extract a substring. Students are scored based on the number of errors in their SQL statements.

Uploaded by

Isaiah Lastra
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Single Row Functions

This document contains a quiz for a Database Systems 1 course assessing SQL skills. It provides 4 multiple choice questions asking students to write SQL statements to: 1) create a new email by concatenating parts of first and last names with employee ID, sorted in ascending order; 2) pad a string with asterisks to a certain length; 3) calculate the number of months between two dates; and 4) find the position of a character in a string and extract a substring. Students are scored based on the number of errors in their SQL statements.

Uploaded by

Isaiah Lastra
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Technological Institute of the Philippines

938 Aurora Blvd. Cubao, Quezon City

College of Information Technology Education

ITE 006 – Database Systems 1 (Oracle 1)

Preliminary Period
Single-Row Functions

Name: Surname, Firstname Mi. Date:


Program / Section: Instructor: Ms. Roxanne A. Pagaduan
Assessment Task: Quiz No. 3 (Hands-on)
The following questions support the attainment of CILOs:
1. Write SQL statements based on given problems and retrieve data in the database.
2. Compare the use of operators and functions.

Score Equivalent:
No error/Correct Query = 5points
1-3 errors = 3points
4-5 errors = 1point
More than 5 errors/Not running = No point

1. Create a new email, which will contain the first 3 letters of the first name and last name and
employee id. Sort the data in ascending order. Do not use Concat Operator ||. See sample output
below for additional character strings and formatting.
Sample Output:

SELECT CONCAT(
CONCAT(
CONCAT(
CONCAT(LOWER(SUBSTR(first_name,1,3)) , UPPER(SUBSTR(last_name,1,3))) ,
'_') , SUBSTR(employee_id,1,3)), '@yahoo.com') AS "New Email"
FROM employees
ORDER BY "New Email";

2. Starting with the string “Oracle Internet Academy”, pad the string to create
****Oracle****Internet****Academy****

SELECT REPLACE(RPAD(LPAD('Oracle Internet Academy', 27, '*'),31,'*'),' ', '****') AS


"OIA"
FROM DUAL;
3. How many months between your birthday this year and January 1 next year?

SELECT MONTHS_BETWEEN
(TO_DATE('01-01-2020','MM-DD-YYYY'),
TO_DATE('03-16-2019','MM-DD-YYYY') ) "Months"
FROM DUAL;

4. What’s the position of “I” in “Oracle Internet Academy”? Label as Position. Use the string “Oracle
Internet Academy” to produce the following output below. Label this column as The Net. Write your
SQL Statement
.

SELECT INSTR('Oracle Internet Academy' , 'I') "Position"


, CONCAT(' ' , SUBSTR('Oracle Internet Academy',13,3)) "The"
FROM DUAL;

You might also like