You are on page 1of 18

1. Which are not DCL operations?

A Insert
B Grant
C Delete
D Update
E Revoke
F Commit
G Rollback

2. Which of the following is not a DML command?

A Set transaction
B Explain plan
C Update
D Grant
E Insert
F Create
G Alter
H Revoke

3. Which of the following is not a DDL command?


ADrop
B Create
C Alter
D Revoke
E Explain plan
F Insert
G Update
H Delete

4. Which of the following statements are not true regarding the primary key?

AThere can only be one primary key in a table


B An index is automatically generated upon creation of a primary key
C A primary key can accept null values
D A primary key can be composite
E A primary key constraint can be either at the column level or at the table level
F There can be more than one primary key in a table
5. Which of the following statements are wrong about primary keys?
A The primary key field must contain unique values
B The primary key field can contain null values
C A primary key is the column or set of columns that makes every row in the table unique
D A primary key can be created with a maximum of three columns
E Each table can have more than one primary keys
F Unique key is another name for primary key

6. Which statements are true for views?


A The definition of a view is stored in data dictionary
B Views provide a more secure way of retrieving data
C Views are actually Tables and store data in the same manner as Tables

7. Examine the data in the EMPLOYEES table given below:


LAST_NAME DEPARTMENT_ID SALARY

ALLEN 10 3000
MILLER 20 1500
KING 20 2200
DAVIS 30 5000
Which of the following Subqueries work?

ASELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY
department_id);
B SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY
department_id);
C SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary)
FROM employees GROUP BY department_id);
D SELECT department_id FROM employees WHERE SALARY > ALL (SELECT AVG(salary) FROM
employees GROUP BY department_id);
E SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM
employees GROUP BY AVG(SALARY));
8. Examine the description of the STUDENTS table:
STD_ID NUMBER (4)
COURSE_ID VARCHAR2 (10)
START_DATE DATE
END_DATE DATE
The aggregate functions valid on the START_DATE column are:
ASUM(start_date)
B AVG(start_date)
C COUNT(start_date)
D AVG(start_date, end_date)
E MIN(start_date)

9. Select all the appropriate options.


A table is a multiset of rows
B A table is a two-dimensional array of rows and columns
C A table is always dependent on other tables
D A third normal form table is a table free of redundant data
E A table must have a primary key

10. Which of the following field names are correct?


AEmpNo
B 25Block
C #AccountID
D _CustomerName
E Product.Name

11. Which component of an RDBMS validates the syntax of the user's query?
A Query Parser
B The Database Manager
C Query Optimization
D Database Administrator

12. What does the term DDL stand for?


A Data Description Language
B Dynamic Data Language
C Data Definition Language
D Data Derived Language
E Descriptive Data Language
13. Which of the following can be used to uniquely identify a row?
A Primary Key
B Unique Key
C Foreign Key
D All of the above
14. : ________ is an operation that displays rows which meet a condition.

A Restriction

B Extraction

C Projection

D Intersection

E Union

F Minus

G None of the above

15. A table Students has a column called name which stores the names of the students. What will be
the correct query to display the names of the students in reverse order?

A Select name from students reverse;

B Select name from students reverse name;

C Select name from students order by name descending;

D Select name from students order by name reverse;

E Select name from students order by name desc;

F Select desc name from students

G Select reverse name from students;

16. What items, other than column names can be included in the select clause?

A Arithmetic expressions

B Column aliases

C Concatenated columns

D None of the above


17. Which of the following statements is true?
(a)The Insert statement creates new rows
(b)The Update statement modifies the table structure
A only (a) is true
B only (b) is true
C both (a) and (b) are true
D both (a) and (b) are false

18. Which operator will be evaluated first in the following statement:


select (age + 3 * 4 / 2 - 8) from emp
A+
B-
C/
D*

19. What are the columns of a table called in a relational model?


A Attributes
B Rows
C Tuples
D Constraints
E Keys
F Indexes
G Sets
H Elements

20. The level of data abstraction which describes how the data is actually stored is?
A Physical level
B Conceptual level
C Storage level
D File level

21. Which of the following is not a set operator?


A Union
B Union all
C Intersect
D Minus
E Minus all
22. View the following Create statement:
1 Create table Pers
2 (EmpNo Number(4) not null,
3 EName Char not null,
4 Join_dt Date not null,
5 Pay Number)
Which line contains an error?
A1
B2
C3
D4
E5

23. For which SQL operation is Alter Table used?


A To add a column
B To add an integrity constraint
C To modify storage characteristics
D To enable/disable or drop an integrity constraint
E all of the above

24. < and > are examples of _________ type of operators.


A Logical
B Assignment
C Ternary
D Relational
E Numeric
F Comparison
G None of the above
H Arithmetic

25. Examine the two SQL statements given below:


SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC
What is true about them?
A The two statements produce identical results
B The second statement returns an error
C There is no need to specify DESC because the results are sorted in descending order by default

26. What does MOD() function do?


A Returns the remainder after division
B Modifies the column definition
C Modifies the definition of a table
D None of the above

27. The names of those departments where there are more than 100 employees have to be
displayed. Given two relations, employees and departments, what query should be used?
Employee
---------
Empno
Employeename
Salary
Deptno

Department
---------
Deptno
Departname
A Select departname from department where deptno in (select deptno from employee group by
deptno having count(*) > 100);
B Select departname from department where deptno in (select count(*) from employee group
by deptno where count(*) > 100);
C Select departname from department where count(deptno) > 100;
D Select departname from department where deptno in (select count(*) from employee where
count(*) > 100);

28. An association of several entities in a Entity-Relation model is called?


A Tuple
B Record
C Relationship
D Field

29. Which of the following statements regarding views are incorrect?


A A view is like a window through which data on tables can be viewed or changed
B A view is derived from another table
C A view cannot be derived from another view
D A view is stored as a select statement only
E A view has no data of its own
F A view is another name for a table
30. Consider the following tables:
Books
------
BookId
BookName
AuthorId
SubjectId
PopularityRating (the popularity of the book on a scale of 1 to 10)
Language (such as French, English, German etc)

Subjects
---------
SubjectId
Subject (such as History, Geography, Mathematics etc)

Authors
--------
AuthorId
AuthorName
Country

What is the query to determine the names of the Authors who have written more than 1 book?
A select AuthorName from Authors where AuthorId in (select AuthorId from Books group by
AuthorId having count(*)>1)
B select AuthorName from Authors, Books where Authors.AuthorId=Books.AuthorId and
count(BookId)>1
C select AuthorName from Authors, Books where Authors.AuthorId=Books.AuthorId group by
AuthorName having count(*)>1
D select AuthorName from Authors where AuthorId in (select AuthorId from Books having
count(BookId)>1)

31. When a table is dropped using a simple DROP statement, SQL performs some more operations
simultaneously, select all the valid operations?

A Removes all rows from the table


B Drops all the table's indexes
C Removes all dependent views
D Removes all dependent procedures
32. Which of the following statement is correct regarding table creation?

A Tables once created cannot be modified to add columns


B Constraints can only be given while table creation
C One can easily create a table from a given table
D When a table is created from another table, all the constraints are copied as well
E The width of the columns cannot be modified
F Columns cannot be removed from a table

33. A production house has two sales outlets. Both outlets are maintaining their data separately in
schemas A and B respectively. The Management wants to see the sale of both outlets in one
report. Both outlets are using tables called Sales which have identical structure. Which method
you will adopt to create the report?

A Select * from A.Sales join B.Sales


B Select * from A.Sales union all B.Sales
C Select * from A.Sales, B.Sales
D None of the above

34. What are the programs that execute automatically whenever DML operations are performed on
tables called?

A Triggers
B Procedures
C Functions
D None of the above
35. Which of the following is not a type of constraint?

A Primary key
B Unique
C Check
D Distinct
E Default
36. Consider the query:
SELECT name
FROM Student
WHERE name LIKE '_a%';
Which names will be displayed?

A Names starting with "a"


B Names containing "a" as the second letter
C Names starting with "a" or "A"
D Names containing "a" as any letter except the first
37. A production house needs a report about the sale where total sale of the day is more than
$20,000. Which query should be used?

A select * from orders where sum(amount) > 20000


B select orderdate, sum(amount) from orders where sum(amount) > 20000 order by OrderDate
C select orderdate, sum(amount) from orders group by orderdate having sum(amount) > 20000
D select orderdate, sum(amount) from orders group by OrderDate where sum(amount) > 20000

38. Which character function should be used to return a specified portion of a character string?

A CONCAT
B LENGTH
C SUBSTR
D INITCAP

39. What will happen if you query the emp table as shown below:
select empno, DISTINCT ename, Salary from emp;

A EMPNO, unique value of ENAME and then SALARY are displayed


B EMPNO, unique value ENAME and unique value of SALARY are displayed
C DISTINCT is not a valid keyword in SQL
D No values will be displayed because the statement will return an error

40. What is a rollback of transactions normally used for?

A Recover from the transaction failure


B Update the transaction
C Retrieve old records
D None of the above

41. The STUDENT_GRADES table has these columns:

STUDENT_ID NUMBER (12)


SEMESTER_END DATE
GPA NUMBER (4)

Which of the following statements finds the highest Grade Point Average (GPA) per semester?

A SELECT MAX(gpa) FROM student_grades WHERE gpa IS NOT NULL


B SELECT (gpa) FROM student_grades GROUP BY semester_end WHERE gpa IS NOT NULL
C SELECT MAX(gpa) FROM student_grades WHERE gpa IS NOT NULL GROUP BY semester_end
D SELECT MAX(gpa) GROUP BY semester_end WHERE gpa IS NOT NULL FROM student_grades
E SELECT MAX(gpa) FROM student_grades GROUP BY semester_end WHERE gpa IS NOT NULL
42. Which of the following is not a single value function?

A Round
B Floor
C Avg
D Sqrt
E Tan
43. An RDBMS performs the following steps:
1)It calculates the results of the group functions of each group
2)It groups those rows together based on the group by clause
3)It orders the groups based on the results of the group functions in the order by clause
4)It chooses and eliminates groups based on the having clause
5)It chooses rows based on the where clause
Arrange the above steps in the correct order of execution:

A 4,3,5,1,2
B 4,5,3,2,1
C 5,2,1,4,3
D 5,2,3,4,1
E 2,3,1,4,5
F 2,3,1,5,4
G 1,2,3,4,5
H 3,2,1,4,5
44. Data validation can be implemented at the data definition stage through:

A Check constraints with specified values


B Referential constraints, by creating foreign keys for another table
C Default value of column
D Not Null constraint
45. What clause should be used to display the rows of a table in ascending order of a particular
column?

A Where
B Order By
C Group By
D Having
E First Group By and then Having
F Like
G Between
46. What is the error in the following query if the Students table contains several records?

select name from students where name =

(select name from students order by name);

A = should be replaced by in operator

B Order by clause in the subquery should be preceded with a group by clause

C Order by clause in the subquery can be used only if the where and group by clauses have been
applied

D Group by clause should be applied to the outer query

E An order by clause is not allowed in a subquery

F There is no error

47. In which type of database is SQL used?


A Hierarchical
B Network
C Relational
D Object oriented
E All of above
48. The concept of data independence is similar to the concept of ________
A Data type
B Abstract data type
C Consolidation
D Isolation
Evaluate the following SQL statement:

49. SELECT e.employee_id, (.15* e.salary) + (.5 * e.commission_pct) + (s.sales_amount * (.35 *


e.bonus)) AS CALC_VALUE FROM employees e, sales s WHERE e.employee_id = s.emp_id;

What will happen if all the parentheses are removed from the calculation?

A The value displayed in the CALC_VALUE column will be lower


B The value displayed in the CALC_VALUE column will be higher
C There will be no difference in the value displayed in the CALC_VALUE column
D An error will be reported
50. Examine the query:-
select (2/2/4) from tab1;
where tab1 is a table with one row. This would give a result of:

A4
B2
C1
D .5
E .25
F0
G8
H 24
51. Where should sub queries be used?
A To define the set of rows to be inserted in a table
B To define the set of rows to be included in a view
C To define one or more values to be assigned to existing rows
D To provide values for conditions in the Where clause
E To define a table to be operated on by a containing query
F All of the above are correct
G None of the above is correct
52. In which sequence are queries and sub-queries executed by the SQL Engine?

A primary query -> sub query -> sub sub query and so on
B sub sub query -> sub query -> prime query
C the whole query is interpreted at one time
D there is no fixed sequence of interpretation, the query parser takes a decision on the fly
53. Are both the statements correct?
(a)where deptno in(2,4,5)
(b)where deptno=2 or deptno=4 or deptno=5

A True
B False
54. What is the correct order of clauses in the select statement?
1 select
2 order by
3 where
4 having
5 group by
A 1,2,3,4,5
B 1,3,5,4,2
C 1,3,5,2,4
D 1,3,2,5,4
E 1,3,2,4,5
F 1,5,2,3,4
G 1,4,2,3,5
H 1,4,3,2,5
55. There are two tables A and B. You are retreiving data from both tables where all rows from B
table and only matching rows from A table should be displayed. Which type of join you will
apply between A and B tables?
A Inner join
B Left outer join
C Right outer join
D Self join
56. Point out the incorrect statement regarding group functions:
A Group functions act on a group of rows
B Group functions return one result for all the rows operated upon
C Group functions ignore the null values
D Stdev and variance are examples of group functions
E One cannot combine group and single value functions in a query
F Sum is not a group function
57. How many foreign key constraints can a table have?
A1
B2
C3
D4
E5
F6
G None of these above
58. Which statement is correct for FIRST NORMAL FORM?
A Includes only tables that do not have composite primary keys
B Must have data stored in a two-dimensional table with no repeating groups
C Every non-key column is nontransitively dependent upon its primary key
D None of these above
59. What is wrong with the following query:
select * from Orders where OrderID = (select OrderID from OrderItems where ItemQty > 50)
A In the sub query, '*' should be used instead of 'OrderID'
B The sub query can return more than one row, so, '=' should be replaced with 'in'
C The sub query should not be in parenthesis
D None of these above
60. A company has the following departments:
Marketing , Designing , Production , Packing
What will be the result of the following query?
select * from table where department < 'Marketing';
A The query will return " Designing , Packing "
B The query will return " Designing , production ,Packing "
C The query will return "Packing"
D Strings cannot be compared using < operator
E The query will return " Designing "
61. Which of the following is not a numeric group function?
A Avg
B Count
C Highest
D Max
E Stdev
F Sum
62. Consider the following tables:
Books
------
BookId
BookName
AuthorId
SubjectId
PopularityRating (the popularity of the book on a scale of 1 to 10)
Language (such as French, English, German etc)
Subjects
---------
SubjectId
Subject (such as History, Geography, Mathematics etc)
Authors
--------
AuthorId
AuthorName
Country
What is the query to determine which German books(if any) are more popular than all the
French?
select bookname from books where language='German' and popularityrating = (select
popularityrating from books where language='French')
B select bookname from books where language='German' and popularityrating > (select
popularityrating from books where language='French')
C select bookname from books where language='French' and popularityrating > (select
max(popularityrating) from books where language='German')
D select bookname from books where language='German' and popularityrating > (select
max(popularityrating) from books where language='French')
63. Consider the following tables:
Books
------
BookId
BookName
AuthorId
SubjectId
PopularityRating (the popularity of the book on a scale of 1 to 10)
Language (such as French, English, German etc)
Subjects
---------
SubjectId
Subject (such as History, Geography, Mathematics etc)
Authors
--------
AuthorId
AuthorName
Country
What is the query to determine which is the most popular book written in French?

A select bookname from books where language='French' and popularityrating = (select


max(popularityrating) from books where language='French')
B select bookname from books where language='French' and popularityrating = (select
max(popularityrating) from books Having language='French')
C select bookname,max(popularityrating) from books where language='French' and
max(popularityrating)
D select bookname,max(popularityrating) from books where language='French' having
max(popularityrating)
64. Which of the following constraints cannot be applied at the table level?

A Primary key
B Foreign key
C Not null
D Check
E Unique
65. A construction company is currently executing three projects- hotel construction, residential
construction and business towers. The construction company employs both Civil Engineers and
Structural Engineers. A Civil Engineer can work on only one project at a time, but each project
can accomodate more than one Civil Engineer. On the other hand, a Structural Engineer can
work on more than one project and a project could accomodate several Structural Engineers.
Define the nature of relationship between (Civil Engineers and Projects) and (Structural
Engineers and Projects)

A one to many, one to one


B one to one, one to many
C many to one, many to many
D many to one, many to one
66. If entity x is existence-dependent on entity y then what is x said to be?

A Dominant entity
B Subordinate entity
C Primary entity
D Secondary entity
Examine the code given below:
67. SELECT employee_id FROM employees WHERE commission_pct=.5 OR salary > 23000
Which of the following statements is correct with regard to this code?

A It returns employees whose salary is 50% more than $23,000


B It returns employees who have 50% commission rate or salary greater than $23,000
C It returns employees whose salary is 50% less than $23,000
D None of these above
68. Consider the following tables:
Books
BookId
BookName
AuthorId
SubjectId
PopularityRating (the popularity of the book on a scale of 1 to 10)
Language (such as French, English, German etc)
Subjects
SubjectId
Subject (such as History, Geography, Mathematics etc)
Authors
AuthorId
AuthorName
Country
What is the query to determine how many books have been written on each subject. Displaying
Name of Subject and count of the Books?

A select subject,count(*) from books,subjects where books.subjectid=subjects.subjectid group


by books.subjectid
B select count(*),subject from books,subjects where books.subject.id=subjects.subject.id group
by subjects.subject
C select subject,count(*) from books,subjects where books.Authorid=subjects.Authorid group by
books.subjectid,subjects.subject
D select subject,count(*) from books,subjects where books.BookId=subjects.BookId group by
books.subjectid,subjects.subject
69. Which of the following statements are true?

A With DDL you can create and remove tables, schemas, domains, indexes and views
B Select, Insert and Update are DCL commands
C Grant and Revoke are DML commands
D Commit and Rollback are DCL commands