Quiz
Theory of database (Meirzhan)
Questions in this quiz (81)
1A DISTINCT must always be user in the top-most SELECT statement of a set operation
- ATrue
- BFalse
2A parent table referenced by a child table may not be dropped
- ATrue
- BFalse
3A SELECT statement that is embedded in a clause of another SELECT statement is called
- AMain query
- BSubquery
- CInner query
- DOuter query
4A subquery must be enclosed in _________ .
- ADouble quotes
- BSingle quotes
- CParantheses
- DBraces
5A table can be created with or without data
- ATrue
- BFalse
6Any user can grant or revoke ant type of system privileges to or from another user.
- ATrue
- BFalse
7Both object and system privileges can be granted through a single role to a user.
- ATrue
- BFalse
8By default, the foreign key restricts deletes of any parent row that has a corresponding child row(s).
- ATrue
- BFalse
9Comparison conditions fall into two classes:
- ASingle-column operators (>, \=, >\=, <, <>,<\=) and multiple-column operators (IN, ANT, ALL)
- BSingle-row operators (>, \=, >\=, <, <>,<\=) and multiple-column operators (IN,ANY,ALL)
- CSingle-row operators (>, \=, >\=, <, <>,<\=) and multiple-row operators (IN,ANY,ALL)
- DMultiple-row operators (>, \=, >\=, <, <>,<\=) and single-row operators (IN,ANY,ALL)
10Consider the EMPLOYEES table. When condition in the WHERE clause limit the employees to IT Programmers with salary greater than 5000?
- AWHERE salary>5000 AND job_id \= 'IT_PROG'
- BWHERE salary>5000 AND job_id \= "IT_PROG"
- CWHERE salary>5000 AND job_id \= IT_PROG
- DWHERE salary>5000 OR job_id \= 'IT_PROG'
11Consider the EMPLOYEES table. Which condition in the WHERE clause limit the employees to those whose salary is greater than 5000 but less than 18000?
- AWHERE salary > 5000 OR salary < 18000
- BWHERE salary < 5000 AND salary > 18000
- CWHERE salary > 5000 AND salary < 18000
- DWHERE salary >5000 AND salary > 18000
12Consider 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'?
- AWHERE last_name \= 'K%' and first_name \= 'K%'
- BWHERE last_name LIKE 'K_' and first_name LIKE 'K_'
- CWHERE last_name LIKE 'K%' and first_name LIKE 'K%'
- DWHERE last_name and first_name \= 'K%'
13Consider the EMPLOYEES table. Which condition in the WHERE clause limit the employees to those who do not work in the departments 90 and 60?
- AWHERE department_id \= 90 AND department_id \= 60
- BWHERE department_id IN (90,60)
- CWHERE department_id NOT IN (90,60)
- DWHERE department_id \=90 PR department_id \= 60
14Consider the EMPLOYEES table. Which condition in the WHERE clause limit the employees to those who work in the department prompted by the user?
- AWHERE department_id \= '%Department'
- BWHERE department_id LIKE '%Department'
- CWHERE department_id \= '&Department'
- DWHERE department_id like '_Department'
15Consider the EMPLOYEES table. Which of the following statements displays the date in the 'January, 19 1998'?
- ASELECT TO_DATE(hire_date,'fmMONTH, DD YYYY') FROM employees
- BSELECT TO_DATE(hire_date,'fmMON, DD YEAR') FROM employees
- CSELECT TO_CHAR(hire_date,'fmMonth, DD YYYY') FROM employees
- DSELECT TO_DATE(hire_date,'fmMonth, DD YYYY') FROM employees
16Consider the EMPLOYEES table. Which of the following conditions in the WHERE clause will generate an error?
- ASELECT * FROM employees WHERE last_name\='&Name'
- BSELECT job_id, SUM(salary) FROM employees GROUP BY '&Column'
- CSELECT * FROM &Table
- DSELECT &Column FROM employees
17Consider the EMPLOYEES table. Which of the following displays the maximum average salary for each department?
- ASELECT MAX(AVG(salary)) FROM employees
- BSELECT department_id, MAX(AVG(salary)) FROM employees GROUP BY department_id
- CSELECT MAX(AVG(salary)) FROM employees GROUP BY department_id
- DSELECT AVG(MAX(salary)) FROM employees GROUP BY department_id
18Consider 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?
- ASELECT last_name ||'has been working since' || hire_date "Employee Information" FROM employees;
- BSELECT last_name || 'has been working since' || hire_date Employee Information FROM employees
- CSELECT last_name || "has been working since" || hire_date "Employee Information" FROM employees;
- DSELECT last_name || 'has been working since' || hire_date 'Employee Information' FROM employees;
19Consider the EMPLOYEES table. Which of the following statements count the number of employees within each department?
- ASELECT department_id, COUNT(last_name) FROM employees GROUP BY department_id
- BSELECT department_name, COUNT(last_name) FROM employees GROUP BY department_id
- CSELECT department_id, COUNT(last_name) FROM departments GROUP_BY last_name
- DSELECT department_id, department_name, COUNT(last_name) FROM employees GROUP BY department_id
20Consider 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
- AAn error will occur since none of the JOIN operations is used
- BAn error will occur since in the SELECT clause a column thet is used to join the tables is missing
- CThe last names of the employees and their salaries will be displayed along with the departments names where the employees work
- DThe Cartesian product of the two tables based on the department_id column will be displayed
21Consider 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
- AORDER BY salary;
- BORDER BY 2;
- CORDER BY "Salary" ASC;
- DORDER BY Salary DESC;
22Consider 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
- AORDER BY salary;
- BORDER BY 2;
- CORDER BY "Salary" ASC;
- DORDER BY Salary DESC;
23Delete the zip codes 02199 and 43011 from the ZIPCODE table. Make the change permanent.
- ADELETE FROM zipcode WHERE zip ANY ('02199','43011') COMMIT
- BDELETE FROM zipcode WHERE zip ANY ('02199','43011')
- CDELETE FROM zipcode WHERE zip IN ('02199','43011') COMMIT
- DDELETE FROM zipcode WHERE zip ALL ('02199','43011') COMMIT
24Constraints always have a name.
- ATrue
- BFalse
25DML statement such as INSERT, UPDATE, DELETE, and MERGE obtain a lock on the row(s), so other users cannot manipulate it.
- ATrue
- BFalse
26If 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:
- ASELECT * FROM userb.employees;
- BSELECT * FROM employees;
- CSELECT * FROM usera.employees;
- DSELECT * FROM employees.userb;
27It is possible to combine from two tables that do not have a primary key/foreign key relationship into one result using a set operation.
- ATrue
- BFalse
28Privileges, roles, and synonyms are all used to implement security in an Oracle Database.
- ATrue
- BFalse
29Queries containing set operators are called ______ .
- ACompound queries
- BSubqueries
- CInner queries
- DOuter queries
30Queries that return more than one row from the inner SELECT statement are called
- AMultiple-row subqueries
- BMultiple-column subqueries
- CSing-column subqueries
- DSingle-row subqueries
31Queries that return only one row from the inner SELECT statement are called
- AMultiple-column subqueries
- BSingle-row subqueries
- CSingle-column subqueries
- DMultiple-row subqueries
32What will be the result of the following SQL statement?
SELECT INITCAP(SUBSTR(CONCAT('Hello',world),4,3)) FROM DUAL;- ALLO
- BLlo
- CLow
- DLOW
33What 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- AThe number of department in all cities is shown
- BThe number of departments in EACH city is shown.
- CAn error will occur since the GROUP BY clause cannot be used with NATURAL JOIN
- DThe number if departments in one particular city is shown
34What will be the result of the following query?
SELECT ROUND (63.548, -1) FROM DUAL;
- A64
- B60
- C63
- D70
35What will be the result of the following SQL statement?
SELECT SUBSTR ('Hello,World!!!',13) FROM DUAL- AAn error will occur, since SUBSTR function need to take 3 parameters
- BHello,World!!!13
- C!!!
- DHello, World!
36The ______ operator compares a value to every value returned by a subquery.
- ANOT
- BALL
- CSOME
- DANY
37The condition INSERT FIRST command evaluates the WHEN condition in order. For all conditions that are true a row is inserted into the appropriate table.
- ATrue
- BFalse
38The data dictionary view USER_TAB_PRIVS_MADE lists details of table privilege grants performed by the current user.
- ATrue
- BFalse
39The data of a temporary table is visible to all session.
- ATrue
- BFalse
40The NUMBER data types is usually the best choice for a primary key.
- ATrue
- BFalse
41The subquery generally executes ______ , and its output is used to complete the query condition for the main (or ____ ) query.{
- AFirst, outer
- BLast, outer
- CLast, inner
- DFirst, inner
42The TRANCATE command and the TRUNC function can be used interchangeably.
- ATrue
- BFalse
43The TRUNCATE command removes all data permanently from a table.
- ATrue
- BFalse
44The UNION and UNION ALL set operator have the opposite effect other.
- ATrue
- BFalse
45The ____ operator compares a value to EACH value returned by a subquery
- ANOT
- BANY
- CSOME
- DALL
46The ____ operator returns all rows that are selected by either query
- AUNION ALL
- BINTERSECT
- CUNION
- DMINUS
47The ______ constraint defines a condition that each row must satisfy.
- APRIMARY KEY
- BCHECK
- CUNIQUE
- DFOREIGN KEY
48To obtain a list of last names that students and instructors share, you use the MINUS set operator
- ATrue
- BFalse
49Transaction control determines when data manipulates becomes permanent in a database.
- ATrue
- BFalse
50Use the _____ operator to return all rows from multiple tables and eliminate any duplicate rows.
- AUNION
- BMINUS
- CUNION ALL
- DINTERSECT
51What will be the result of the following SQL statement? (SYSDATE is a date of your exam)
SELECT TO_CHAR(SYSDATE, 'Day') FROM Dual;
- A31.05.2013
- BFriday
- C31
- D31-05.2013
52What 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;{
- A31.May.2013
- BAn error will occur
- C31.05.2013
- D31.05.13
53When executed, this statement cannot be rolled back
- AALTER TABLE
- BDROP TABLE
- CREMOVE TABLE
- DDELETE TABLE
54When inserting data into a table form another table, the table names and columns must be the same.
- ATrue
- BFalse
55When using LIKE condition which symbol is used to denote one character?
- A_
- B+
- C%
- D*
56When using LIKE conditions which symbol is used to denote zero or many characters?
- A+
- B*
- C%
- D_
57Which command is used to view the structure of the table LOCATIONS?
- ADESCRIBE LOCATIONS
- BSHOW STRUCTURE LOCATIONS
- CSELECT * FROM LOCATIONS
- DPRINT LOCATIONS
58Which is right of the following clauses?
- ASELECT... WHERE ... ORDER BY ... GROUP BY
- BSELECT ... FROM ... GROUP BY ... ORDER BY ... WHERE
- CSELECT...FROM...WHERE...GROUP BY...ORDER BY
- DSELECT ... FROM ... WHERE ... ORDER BY ... GROUP BY
59Which keyword is used to eliminate duplicate rows in the result?
- ADISTINCT
- BDESCRIBE
- CHAVING
- DGROUP BY
60Which keyword is used to provide an alias to a column?
- ACOLUMN
- BAS
- CALIAS
- DIS
61Which of the following clauses is used to limit the rows that are retrieved by the query?
- AWHERE
- BORDER BY
- CFROM
- DGROUP BY
62Which of the following functions finds the numeric position of a named character?
- ACONCAT
- BINSTR
- CTRIM
- DSUBSTR
63Which of the following functions is not single-row function?
- ACONCAT
- BSUM
- CUPPER
- DROUND
64Which of the following functions joins two strings together?
- ACONCAT
- BTRIM
- CINSTR
- DSUBSTR
65Which of the following is a concatenation operator?
- A&
- B||
- C*
- D+
66Which of the following SQL statements will generate an error?
- ASELECT last_name Name FROM employees WHERE Name like 'K%'
- BSELECT last_name Name FROM employees ORDER BY Name
- CSELECT department_id Dep, COUNT(last_name) Num FROM employees GROUP BY department_id HAVING Num>5
- DSELECT department_id Dep, COUNT(last_name) FROM employees GROUP BY dep
67Which of the following statements about aliases is NOT true?
- AThe keyboard AS between an alias and a column name is optional
- BAliases always require double quotation marks
- CAliases immediately follows the column name
- DAliases rename column heading
68Which of the following statements is NOT true?
- ASQL statements are no case sensitive
- BKeywords cannot be abbreviated
- CSQL statement can be only one line
- DKeywords cannot be split across lines
69Which statement discards all pending data changes
- ASAVEPOINT
- BCOMMIT
- CDISCARD
- DROLLBACK
70Which symbol do you use if you need to choose all the columns from the table to the result query?
- A%
- BAll
- C+
- D*
71Which symbol is used to create a substitution variable?{
- A&
- B_
- C%
- D*
72Write SQL statement for display the department numbers with more than employees in each dept.
- ASelect deptno, count(deptno) from emp group by deptno having count(*)>3;
- BSelect deptno, count(deptno) from deptno group by emp having count(*)>3;
- CSelect deptno, count (emp) from deptno group by emp having count(*)>2;
- DSelect deptno, count (deptno) from emp group by deptno having count(*)>2;
73Write SQL statement for display the names of the employees who are working in the company for the past 5 years:
- ASelect ename from emp where hiredate < add_month(sysdate,-60);
- BSelect ename from emp where hiredate < add_month(sysdate,-5);
- CSelect ename from emp where hiredate < add_month(sysdate,+60);
- DSelect ename from emp where hiredate < add_month(sysdate,+5);
74Write SQL statement for increase salary of all managers by 10%
- AUpdate emp set sal\=sal*1.1 where empno in (select mgr from emo);
- BUpdate emp set sal\=sal*0.1 where empno in (select mgr from emo);
- CUpdate emp set sal\=sal*0.1 where empno in (select emp from emo);
- DUpdate emp set sal\=sal*1.1 where empno in (select emp from emo);
75You can add and drop columns from a table using the ALTER TABLE command.
- ATrue
- BFalse
76You can nor (not?) selectively delete rows a table.
- ATrue
- BFalse
77You can place the subquery in a number of SQL clauses, including the following:
I. WHERE clause
II. HAVING clause
III. FROM clause- AI and II
- BI,II and III
- CI only
- DI and III
78You can update only a single column at a time in a table.
- ATrue
- BFalse
79You cannot drop a user if objects exist in the user's schema.
- ATrue
- BFalse
80You cannot order the results of a set operation
- ATrue
- BFalse
81______ clause can be used and is required in the subquery to perform Top-N analysis.
- AHAVING
- BORDER BY
- CGROUP BY
- DWHERE
Information
- Description
- Exam Quiz on Theory of database (Meirzhan), created by Alex Q on 26/03/2019.
- Author
- Alex Q
- Language
- English
- Views
- 137
- Tags
- Rating
- No ratings yet Rate this quiz