DataBase Tech
DataBase Tech
4) The .................... refers to the way data is organized in and accessible from DBMS.
A) database hierarchy B) data organization
C) data sharing D) data model
18) How many null values can a unique key column have in MySQL
A) Multiple B) 0 C) 1 D) 2
19) How many null values can a primary key column have in MySQL
A) Multiple B) 0 C) 1 D) 2
20) Can the child table foreign key column has null value?
A) True B) False
21) which of the following query is used to delete data from table
A) Drop B) Delete C) Update D) Alter
22) Does MySQL supports composite Primary keys?
A) True B) False
27) which of the following joins will return highest number of rows?
A) Cross Join B) Left Join C) Inner Join D) Right Join
29) Can we have a HAVING Clause in the query without group by clause?
A) True B) False
30) What is the default sort done in MySQL when you order by clause?
Vidyanidhi Info Tech Academy
PG DAC Question Bank
A) Ascending B) Descending C) None D) both
34) In a relational database a referential integrity constraint can be specified with the help of
A) primary key
B) foreign key
C) secondary key
D) none of the above
36) If every non-key attribute is functionally dependent on the entire primary key, then the relation will be in:
A) 1NF
B) 2NF
C) 3NF
D) 4NF
38) A relation is ................... if every field contains only atomic values that is, no lists or sets.
A) 1 NF B) 2 NF C) 3 NF D) BCNF
40) In a LIKE clause, you can could ask for any value ending in "qpt" by writing
A) LIKE %qpt
B) LIKE *ton
C) LIKE ton$
D) LIKE ^.*ton$
52 MySQL is
A) A Programming language
B) A Programming language
C) A technique for writing reliable programs
D) A Relational Database Management System
53 In a LIKE clause, you can ask for any 6 letter value by writing?
Vidyanidhi Info Tech Academy
PG DAC Question Bank
A) LIKE ??????
B) LIKE .{6} Answer 5: LIKE ^.{6}$
C) LIKE ...... (that's six dots)
D) LIKE ______ (that's six underscore characters)
57. What SQL clause is used to restrict the rows returned by a query?
a) AND b) WHERE c) Group d) FROM
58. Which of the following commands should be used to create a database named “student”?
a) CREATE ?I student b) CREATE DATABASE student
c) DATABASE /student d) DATABSE student
59. Which one will delete the table data as well as table structure?
a) TRUNCATE b) DROP c) delete d) All of the above
65. Which of the following is the correct order of keywords for SQL SELECT statements?
A. SELECT, FROM, WHERE
B. FROM, WHERE, SELECT
C. WHERE, FROM,SELECT
D. SELECT,WHERE,FROM;
Vidyanidhi Info Tech Academy
PG DAC Question Bank
66. A subquery in an SQL SELECT statement is enclosed in:
A. braces -- {...}.
B. CAPITAL LETTERS.
C. parenthesis -- (...) .
D. brackets -- [...].
67. Which of the following are the five built-in functions provided by SQL?
A. COUNT, SUM, AVG, MAX, MIN
B. SUM, AVG, MIN, MAX, MULT
C. SUM, AVG, MULT, DIV, MIN
D. SUM, AVG, MIN, MAX, NAME
68. Which of the following do you need to consider when you make a table in SQL?
A. Data types
B. Primary keys
C. Default values
D. All of the above.
69. Find the SQL statement below that is equal to the following: SELECT NAME FROM CUSTOMER WHERE STATE =
'VA';
A. SELECT NAME IN CUSTOMER WHERE STATE IN ('VA');
B. SELECT NAME IN CUSTOMER WHERE STATE = 'VA';
C. SELECT NAME IN CUSTOMER WHERE STATE = 'V';
D. SELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');
70. Which one of the following is used to define the structure of the relation ,deleting relations and relating schemas ?
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema
71. Which one of the following provides the ability to query information from the database and to insert tuples into,
delete tuples from, and modify tuples in the database ?
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema
73. To remove a relation from an SQL database, we use the ______ command.
a) Delete b) Purge c) Remove d) Drop table
76. Which of the following makes the transaction permanent in the database ?
a) View b) Commit c) Rollback d) Flashback
77. In order to undo the work of transaction after last commit which one should be used ?
a) View b) Commit c) Rollback d) Flashback
79. In case of any shut down during transaction before commit which of the following statement is done automatically ?
a) View b) Commit c) Rollback d) Flashback
80. Aggregate functions are functions that take a ___________ as input and return a single value.
a) Collection of values b) Single value c) Aggregate value d) Both a & b
82. All aggregate functions except _____ ignore null values in their input collection.
a) Count(attribute) b) Count(*) c) Avg d) Sum
83. Which of the following should be used to find all the courses taught in the Fall 2009 semester but not in the Spring
2010 semester .
a) Select distinct course id
from section
where semester = ’Fall’ and year= 2009 and
course id not in (select course id
from section
where semester = ’Spring’ and year= 2010);
c) (Select course id
from section
where semester = ’Spring’ and year= 2010)
84. The phrase “greater than at least one” is represented in SQL by _____.
a) < all b) < some c) > all d) > any
85. We can test for the nonexistence of tuples in a subquery by using the _____ construct.
a) Not exist b) Not exists c) Exists d) Exist
90. Foreign key is the one in which the ________ of one relation is referenced in another relation.
a) Foreign key b) Primary key c) References d) Check constraint
91. Which of the following can be addressed by enforcing a referential integrity constraint?
a) All phone numbers must include the area code
b) Certain fields are required (such as the email address, or phone number) before the record is accepted
c) Information on the customer must be known before anything can be sold to that customer
d) When entering an order quantity, the user must input a number and not some text (i.e., 12 rather than ‘a dozen’)
92. The____condition allows a general predicate over the relations being joined.
a) On b) Using c) Set d) Where
93. Which of the join operations do not preserve non matched tuples.
a) Left outer join b) Right outer join c) Inner join d) Natural join
94. What type of join is needed when you wish to include rows that do not have matching values?
a) Equi-join b) Natural join c) Outer join d) All of the mentioned
97. A _____ indicates an absent value that may exist but be unknown or that may not exist at all.
a) Empty tuple b) New value c) Null value d) Old value
100. Which one of the following deletes all the entries but keeps the structure of the relation .
a) Delete from r where P;
b) Delete from instructor where dept name= ’Finance’;
c) Delete from instructor where salary between 13000 and 15000;
d) Delete from instructor;
101. Which of the following deletes all tuples in the instructor relation for those instructors associated with a department
located in the Watson building which is in department relation.
a) Delete from instructor
where dept_name in ‘Watson’;
b) Delete from department
where building=’Watson’;
c) Delete from instructor
where dept_name in (select dept name
from department
where building = ’Watson’);
d) Both a and c
103. Which of the following is the correct format for case statements .
a) Case
when pred1 … result1
when pred2 … result2
...
when predn … resultn
else result0
end
b) Case
when pred1 then result1
when pred2 then result2
...
when predn then resultn
else result0
end
c) Case
when pred1 then result1
when pred2 then result2
...
when predn then resultn
else result0
d) All of the mentioned
105. Which of the following terms does refer to the correctness and completeness of the data in a database?
a) Data security b) Data constraint c) Data independence d) Data integrity
107. If the state of the database no longer reflects a real state of the world that the database is supposed to capture,
then such a state is called
a) Consistent state b) Parallel state c) Durable state d) Inconsistent state
108. Each modification done in database transaction are first recorded into the
a) Harddrive b) Log c) Disk d) Datamar
109. When the transaction finishes the final statement the transaction enters into
a) Active state b) Committed state c) Partially committed state d) Abort state
111. _______ means that data used during the execution of a transaction cannot be used by a second transaction until
the first one is completed.
a) Serializability b) Atomicity c) Isolation d) Time stamping
112. In SQL, which command is used to select only one copy of each set of duplicate rows
A) SELECT DISTINCT B) SELECT UNIQUE C) SELECT DIFFERENT D) All of the above
114. What command is used to get back the privileges offered by the GRANT command?
A) Grant B) Revoke C) Execute D) Run
Vidyanidhi Info Tech Academy
PG DAC Question Bank
115. Which of the following query is correct for using comparison operators in SQL?
A) SELECT sname, coursename FROM studentinfo WHERE age>50 and <80;
B) SELECT sname, coursename FROM studentinfo WHERE age>50 and age <80;
C) SELECT sname, coursename FROM studentinfo WHERE age>50 and WHERE age<80;
D) None of the above
116. How to select all data from studentinfo table starting the name from letter 'r'?
A) SELECT * FROM studentinfo WHERE sname LIKE 'r%';
B) SELECT * FROM studentinfo WHERE sname LIKE '%r%';
C) SELECT * FROM studentinfo WHERE sname LIKE '%r';
D) SELECT * FROM studentinfo WHERE sname LIKE '_r%';
117. Which of the following SQL query is correct for selecting the name of staffs from 'tblstaff' table where salary is
15,000 or 25,000?
A) SELECT sname from tblstaff WHERE salary IN (15000, 25000);
B) SELECT sname from tblstaff WHERE salary BETWEEN 15000 AND 25000;
C) Both A and B
D) None of the above
118. Select a query that retrieves all of the unique course name from the student table?
A) SELECT DISTINCT coursename FROM studentinfo;
B) SELECT UNIQUE coursename FROM studentinfo;
C) SELECT DISTINCT coursename FROM TABLE studentinfo;
D) SELECT INDIVIDUAL coursename FROM studentinfo;
119. Which query is used for sorting data that retrieves the all the fields from empinfo table and listed them in the
ascending order?
A) SELECT * FROM empinfo ORDER BY age;
B) SELECT * FROM empinfo ORDER age;
C) SELECT * FROM empinfo ORDER BY COLUMN age;
D) SELECT * FROM empinfo SORT BY age;
120. Select the right statement to insert values to the stdinfo table.
A) INSERT VALUES ("15", "Hari Thapa", 45, 5000) INTO stdinfo;
B) INSERT VALUES INTO stdinfo ("15", "Hari Thapa", 45, 5000);
C) INSERT stdinfo VALUES ("15", "Hari Thapa", 45, 5000);
D) INSERT INTO stdinfo VALUES ("15", "Hari Thapa", 45, 5000);
121. How to Delete records from studentinfo table with name of student 'Hari Prasad'?
A) DELETE FROM TABLE studentinfo WHERE sname='Hari Prasad';
B) DELETE FROM studentinfo WHERE sname='Hari Prasad';
C) DELETE FROM studentinfo WHERE COLUMN sname='Hari Prasad';
D) DELETE FROM studentinfo WHERE sname LIKE 'Hari Prasad';
125. Which of the following isolation levels doesn’t allow phantom reads?
A) Repeatable Reads B) Read Committed
C) Read uncommitted d) Serializable
Vidyanidhi Info Tech Academy
PG DAC Question Bank
126. Which of the following isolation levels doesn’t allow non-repeatable reads?
A) Repeatable Reads B) Read Committed
C) both D) none