Theory of database (Meirzhan)

Alex Q
Quiz by Alex Q, updated more than 1 year ago
Alex Q
Created by Alex Q about 2 years ago
122
5

Description

Exam Quiz on Theory of database (Meirzhan), created by Alex Q on 26/03/2019.

Resource summary

Question 1

Question
A DISTINCT must always be user in the top-most SELECT statement of a set operation
Answer
  • True
  • False

Question 2

Question
A parent table referenced by a child table may not be dropped
Answer
  • True
  • False

Question 3

Question
A SELECT statement that is embedded in a clause of another SELECT statement is called
Answer
  • Main query
  • Subquery
  • Inner query
  • Outer query

Question 4

Question
A subquery must be enclosed in _________ .
Answer
  • Double quotes
  • Single quotes
  • Parantheses
  • Braces

Question 5

Question
A table can be created with or without data
Answer
  • True
  • False

Question 6

Question
Any user can grant or revoke ant type of system privileges to or from another user.
Answer
  • True
  • False

Question 7

Question
Both object and system privileges can be granted through a single role to a user.
Answer
  • True
  • False

Question 8

Question
By default, the foreign key restricts deletes of any parent row that has a corresponding child row(s).
Answer
  • True
  • False

Question 9

Question
Comparison conditions fall into two classes:
Answer
  • Single-column operators (>, \=, >\=, <, <>,<\=) and multiple-column operators (IN, ANT, ALL)
  • Single-row operators (>, \=, >\=, <, <>,<\=) and multiple-column operators (IN,ANY,ALL)
  • Single-row operators (>, \=, >\=, <, <>,<\=) and multiple-row operators (IN,ANY,ALL)
  • Multiple-row operators (>, \=, >\=, <, <>,<\=) and single-row operators (IN,ANY,ALL)

Question 10

Question
Consider the EMPLOYEES table. When condition in the WHERE clause limit the employees to IT Programmers with salary greater than 5000?
Answer
  • WHERE salary>5000 AND job_id \= 'IT_PROG'
  • WHERE salary>5000 AND job_id \= "IT_PROG"
  • WHERE salary>5000 AND job_id \= IT_PROG
  • WHERE salary>5000 OR job_id \= 'IT_PROG'

Question 11

Question
Consider the EMPLOYEES table. Which condition in the WHERE clause limit the employees to those whose salary is greater than 5000 but less than 18000?
Answer
  • WHERE salary > 5000 OR salary < 18000
  • WHERE salary < 5000 AND salary > 18000
  • WHERE salary > 5000 AND salary < 18000
  • WHERE salary >5000 AND salary > 18000

Question 12

Question
Consider the EMPLOYEES table. Which condition in the WHERE clause limit the employees to those whose last name and first name starts with the letter 'K'?
Answer
  • WHERE last_name \= 'K%' and first_name \= 'K%'
  • WHERE last_name LIKE 'K_' and first_name LIKE 'K_'
  • WHERE last_name LIKE 'K%' and first_name LIKE 'K%'
  • WHERE last_name and first_name \= 'K%'

Question 13

Question
Consider the EMPLOYEES table. Which condition in the WHERE clause limit the employees to those who do not work in the departments 90 and 60?
Answer
  • WHERE department_id \= 90 AND department_id \= 60
  • WHERE department_id IN (90,60)
  • WHERE department_id NOT IN (90,60)
  • WHERE department_id \=90 PR department_id \= 60

Question 14

Question
Consider the EMPLOYEES table. Which condition in the WHERE clause limit the employees to those who work in the department prompted by the user?
Answer
  • WHERE department_id \= '%Department'
  • WHERE department_id LIKE '%Department'
  • WHERE department_id \= '&amp;Department'
  • WHERE department_id like '_Department'

Question 15

Question
Consider the EMPLOYEES table. Which of the following statements displays the date in the 'January, 19 1998'?
Answer
  • SELECT TO_DATE(hire_date,'fmMONTH, DD YYYY') FROM employees
  • SELECT TO_DATE(hire_date,'fmMON, DD YEAR') FROM employees
  • SELECT TO_CHAR(hire_date,'fmMonth, DD YYYY') FROM employees
  • SELECT TO_DATE(hire_date,'fmMonth, DD YYYY') FROM employees

Question 16

Question
Consider the EMPLOYEES table. Which of the following conditions in the WHERE clause will generate an error?
Answer
  • SELECT * FROM employees WHERE last_name\='&amp;Name'
  • SELECT job_id, SUM(salary) FROM employees GROUP BY '&amp;Column'
  • SELECT * FROM &amp;Table
  • SELECT &amp;Column FROM employees

Question 17

Question
Consider the EMPLOYEES table. Which of the following displays the maximum average salary for each department?
Answer
  • SELECT MAX(AVG(salary)) FROM employees
  • SELECT department_id, MAX(AVG(salary)) FROM employees GROUP BY department_id
  • SELECT MAX(AVG(salary)) FROM employees GROUP BY department_id
  • SELECT AVG(MAX(salary)) FROM employees GROUP BY department_id

Question 18

Question
Consider the EMPLOYEES table. Which of the following SQL statements is correct to provide the sentence in the format "King has been working since 01.01.1987" with "Employee Information" alias?
Answer
  • SELECT last_name ||'has been working since' || hire_date "Employee Information" FROM employees;
  • SELECT last_name || 'has been working since' || hire_date Employee Information FROM employees
  • SELECT last_name || "has been working since" || hire_date "Employee Information" FROM employees;
  • SELECT last_name || 'has been working since' || hire_date 'Employee Information' FROM employees;

Question 19

Question
Consider the EMPLOYEES table. Which of the following statements count the number of employees within each department?
Answer
  • SELECT department_id, COUNT(last_name) FROM employees GROUP BY department_id
  • SELECT department_name, COUNT(last_name) FROM employees GROUP BY department_id
  • SELECT department_id, COUNT(last_name) FROM departments GROUP_BY last_name
  • SELECT department_id, department_name, COUNT(last_name) FROM employees GROUP BY department_id

Question 20

Question
Consider the following SQL statement. What will be the result? SELECT e.last_name, e.salary, d.department_name FROM employees e, departments d WHERE e.department_id \= d.department_id
Answer
  • An error will occur since none of the JOIN operations is used
  • An error will occur since in the SELECT clause a column thet is used to join the tables is missing
  • The last names of the employees and their salaries will be displayed along with the departments names where the employees work
  • The Cartesian product of the two tables based on the department_id column will be displayed

Question 21

Question
Consider the SQL statement. Which of the following clauses does not sort the result rows by the salary values in the ascending order? SELECT last_name "Employee", salary "Salary" FROM employees
Answer
  • ORDER BY salary;
  • ORDER BY 2;
  • ORDER BY "Salary" ASC;
  • ORDER BY Salary DESC;

Question 22

Question
Consider the SQL statement. Which of the following clauses does not sort the result rows by salary value in the ascending order? SELECT last_name "Employee", salary "Salary" FROM employees
Answer
  • ORDER BY salary;
  • ORDER BY 2;
  • ORDER BY "Salary" ASC;
  • ORDER BY Salary DESC;

Question 23

Question
Delete the zip codes 02199 and 43011 from the ZIPCODE table. Make the change permanent.
Answer
  • DELETE FROM zipcode WHERE zip ANY ('02199','43011') COMMIT
  • DELETE FROM zipcode WHERE zip ANY ('02199','43011')
  • DELETE FROM zipcode WHERE zip IN ('02199','43011') COMMIT
  • DELETE FROM zipcode WHERE zip ALL ('02199','43011') COMMIT

Question 24

Question
Constraints always have a name.
Answer
  • True
  • False

Question 25

Question
DML statement such as INSERT, UPDATE, DELETE, and MERGE obtain a lock on the row(s), so other users cannot manipulate it.
Answer
  • True
  • False

Question 26

Question
If there are schemas named USERA and USERB, and both have an EMPLOYEES table, then if USERA wants to access the EMPLOYEES table that belongs to USERB, USERA must write select statement as follows:
Answer
  • SELECT * FROM userb.employees;
  • SELECT * FROM employees;
  • SELECT * FROM usera.employees;
  • SELECT * FROM employees.userb;

Question 27

Question
It is possible to combine from two tables that do not have a primary key/foreign key relationship into one result using a set operation.
Answer
  • True
  • False

Question 28

Question
Privileges, roles, and synonyms are all used to implement security in an Oracle Database.
Answer
  • True
  • False

Question 29

Question
Queries containing set operators are called ______ .
Answer
  • Compound queries
  • Subqueries
  • Inner queries
  • Outer queries

Question 30

Question
Queries that return more than one row from the inner SELECT statement are called
Answer
  • Multiple-row subqueries
  • Multiple-column subqueries
  • Sing-column subqueries
  • Single-row subqueries

Question 31

Question
Queries that return only one row from the inner SELECT statement are called
Answer
  • Multiple-column subqueries
  • Single-row subqueries
  • Single-column subqueries
  • Multiple-row subqueries

Question 32

Question
What will be the result of the following SQL statement? SELECT INITCAP(SUBSTR(CONCAT('Hello',world),4,3)) FROM DUAL;
Answer
  • LLO
  • Llo
  • Low
  • LOW

Question 33

Question
What will be the result of the following SQL statement? SELECT count(d.department_name), l.city FROM departments d NATURAL JOIN locations l GROUP BY l.city
Answer
  • The number of department in all cities is shown
  • The number of departments in EACH city is shown.
  • An error will occur since the GROUP BY clause cannot be used with NATURAL JOIN
  • The number if departments in one particular city is shown

Question 34

Question
What will be the result of the following query? SELECT ROUND (63.548, -1) FROM DUAL;
Answer
  • 64
  • 60
  • 63
  • 70

Question 35

Question
What will be the result of the following SQL statement? SELECT SUBSTR ('Hello,World!!!',13) FROM DUAL
Answer
  • An error will occur, since SUBSTR function need to take 3 parameters
  • Hello,World!!!13
  • !!!
  • Hello, World!

Question 36

Question
The ______ operator compares a value to every value returned by a subquery.
Answer
  • NOT
  • ALL
  • SOME
  • ANY

Question 37

Question
The condition INSERT FIRST command evaluates the WHEN condition in order. For all conditions that are true a row is inserted into the appropriate table.
Answer
  • True
  • False

Question 38

Question
The data dictionary view USER_TAB_PRIVS_MADE lists details of table privilege grants performed by the current user.
Answer
  • True
  • False

Question 39

Question
The data of a temporary table is visible to all session.
Answer
  • True
  • False

Question 40

Question
The NUMBER data types is usually the best choice for a primary key.
Answer
  • True
  • False

Question 41

Question
The subquery generally executes ______ , and its output is used to complete the query condition for the main (or ____ ) query.{
Answer
  • First, outer
  • Last, outer
  • Last, inner
  • First, inner

Question 42

Question
The TRANCATE command and the TRUNC function can be used interchangeably.
Answer
  • True
  • False

Question 43

Question
The TRUNCATE command removes all data permanently from a table.
Answer
  • True
  • False

Question 44

Question
The UNION and UNION ALL set operator have the opposite effect other.
Answer
  • True
  • False

Question 45

Question
The ____ operator compares a value to EACH value returned by a subquery
Answer
  • NOT
  • ANY
  • SOME
  • ALL

Question 46

Question
The ____ operator returns all rows that are selected by either query
Answer
  • UNION ALL
  • INTERSECT
  • UNION
  • MINUS

Question 47

Question
The ______ constraint defines a condition that each row must satisfy.
Answer
  • PRIMARY KEY
  • CHECK
  • UNIQUE
  • FOREIGN KEY

Question 48

Question
To obtain a list of last names that students and instructors share, you use the MINUS set operator
Answer
  • True
  • False

Question 49

Question
Transaction control determines when data manipulates becomes permanent in a database.
Answer
  • True
  • False

Question 50

Question
Use the _____ operator to return all rows from multiple tables and eliminate any duplicate rows.
Answer
  • UNION
  • MINUS
  • UNION ALL
  • INTERSECT

Question 51

Question
What will be the result of the following SQL statement? (SYSDATE is a date of your exam) SELECT TO_CHAR(SYSDATE, 'Day') FROM Dual;
Answer
  • 31.05.2013
  • Friday
  • 31
  • 31-05.2013

Question 52

Question
What will be the result of the following SQL statement? (SYSDATE is a date of your exam) SELECT TO_CHAR(SYSDATE, 'DD.MM.YY') FROM Dual;{
Answer
  • 31.May.2013
  • An error will occur
  • 31.05.2013
  • 31.05.13

Question 53

Question
When executed, this statement cannot be rolled back
Answer
  • ALTER TABLE
  • DROP TABLE
  • REMOVE TABLE
  • DELETE TABLE

Question 54

Question
When inserting data into a table form another table, the table names and columns must be the same.
Answer
  • True
  • False

Question 55

Question
When using LIKE condition which symbol is used to denote one character?
Answer
  • _
  • +
  • %
  • *

Question 56

Question
When using LIKE conditions which symbol is used to denote zero or many characters?
Answer
  • +
  • *
  • %
  • _

Question 57

Question
Which command is used to view the structure of the table LOCATIONS?
Answer
  • DESCRIBE LOCATIONS
  • SHOW STRUCTURE LOCATIONS
  • SELECT * FROM LOCATIONS
  • PRINT LOCATIONS

Question 58

Question
Which is right of the following clauses?
Answer
  • SELECT... WHERE ... ORDER BY ... GROUP BY
  • SELECT ... FROM ... GROUP BY ... ORDER BY ... WHERE
  • SELECT...FROM...WHERE...GROUP BY...ORDER BY
  • SELECT ... FROM ... WHERE ... ORDER BY ... GROUP BY

Question 59

Question
Which keyword is used to eliminate duplicate rows in the result?
Answer
  • DISTINCT
  • DESCRIBE
  • HAVING
  • GROUP BY

Question 60

Question
Which keyword is used to provide an alias to a column?
Answer
  • COLUMN
  • AS
  • ALIAS
  • IS

Question 61

Question
Which of the following clauses is used to limit the rows that are retrieved by the query?
Answer
  • WHERE
  • ORDER BY
  • FROM
  • GROUP BY

Question 62

Question
Which of the following functions finds the numeric position of a named character?
Answer
  • CONCAT
  • INSTR
  • TRIM
  • SUBSTR

Question 63

Question
Which of the following functions is not single-row function?
Answer
  • CONCAT
  • SUM
  • UPPER
  • ROUND

Question 64

Question
Which of the following functions joins two strings together?
Answer
  • CONCAT
  • TRIM
  • INSTR
  • SUBSTR

Question 65

Question
Which of the following is a concatenation operator?
Answer
  • &amp;
  • ||
  • *
  • +

Question 66

Question
Which of the following SQL statements will generate an error?
Answer
  • SELECT last_name Name FROM employees WHERE Name like 'K%'
  • SELECT last_name Name FROM employees ORDER BY Name
  • SELECT department_id Dep, COUNT(last_name) Num FROM employees GROUP BY department_id HAVING Num>5
  • SELECT department_id Dep, COUNT(last_name) FROM employees GROUP BY dep

Question 67

Question
Which of the following statements about aliases is NOT true?
Answer
  • The keyboard AS between an alias and a column name is optional
  • Aliases always require double quotation marks
  • Aliases immediately follows the column name
  • Aliases rename column heading

Question 68

Question
Which of the following statements is NOT true?
Answer
  • SQL statements are no case sensitive
  • Keywords cannot be abbreviated
  • SQL statement can be only one line
  • Keywords cannot be split across lines

Question 69

Question
Which statement discards all pending data changes
Answer
  • SAVEPOINT
  • COMMIT
  • DISCARD
  • ROLLBACK

Question 70

Question
Which symbol do you use if you need to choose all the columns from the table to the result query?
Answer
  • %
  • All
  • +
  • *

Question 71

Question
Which symbol is used to create a substitution variable?{
Answer
  • &amp;
  • _
  • %
  • *

Question 72

Question
Write SQL statement for display the department numbers with more than employees in each dept.
Answer
  • Select deptno, count(deptno) from emp group by deptno having count(*)>3;
  • Select deptno, count(deptno) from deptno group by emp having count(*)>3;
  • Select deptno, count (emp) from deptno group by emp having count(*)>2;
  • Select deptno, count (deptno) from emp group by deptno having count(*)>2;

Question 73

Question
Write SQL statement for display the names of the employees who are working in the company for the past 5 years:
Answer
  • Select ename from emp where hiredate < add_month(sysdate,-60);
  • Select ename from emp where hiredate < add_month(sysdate,-5);
  • Select ename from emp where hiredate < add_month(sysdate,+60);
  • Select ename from emp where hiredate < add_month(sysdate,+5);

Question 74

Question
Write SQL statement for increase salary of all managers by 10%
Answer
  • Update emp set sal\=sal*1.1 where empno in (select mgr from emo);
  • Update emp set sal\=sal*0.1 where empno in (select mgr from emo);
  • Update emp set sal\=sal*0.1 where empno in (select emp from emo);
  • Update emp set sal\=sal*1.1 where empno in (select emp from emo);

Question 75

Question
You can add and drop columns from a table using the ALTER TABLE command.
Answer
  • True
  • False

Question 76

Question
You can nor (not?) selectively delete rows a table.
Answer
  • True
  • False

Question 77

Question
You can place the subquery in a number of SQL clauses, including the following: I. WHERE clause II. HAVING clause III. FROM clause
Answer
  • I and II
  • I,II and III
  • I only
  • I and III

Question 78

Question
You can update only a single column at a time in a table.
Answer
  • True
  • False

Question 79

Question
You cannot drop a user if objects exist in the user's schema.
Answer
  • True
  • False

Question 80

Question
You cannot order the results of a set operation
Answer
  • True
  • False

Question 81

Question
______ clause can be used and is required in the subquery to perform Top-N analysis.
Answer
  • HAVING
  • ORDER BY
  • GROUP BY
  • WHERE
Show full summary Hide full summary

Similar

How to improve your SAT math score
Brad Hegarty
The SAT Math test essentials list
lizcortland
State & Local Govt - Budgetary Accounting
turquoise_cat
RE Keywords - Paper 1 - Religion and life
Kerris Linney
Command Words
Mr Mckinlay
Quick tips to improve your Exam Preparation
James Timpson
LOGARITHMS
pelumi opabisi
Flashcards for CPXP exam
Lydia Elliott, Ed.D
CCNA Security 210-260 IINS - Exam 1
Mike M
Revision Timetable
katy.lay
2014 GCSE History Exam Paper Setup
James McConnell