dbms mcq
dbms mcq
1. Which one of the following is a set of one or more attributes taken collectively to uniquely
identify a record?
a) Candidate key
b) Sub key
c) Super key
d) Foreign key
2. Consider attributes ID, CITY and NAME. Which one of this can be considered as a super key?
a) NAME
b) ID
c) CITY
d) CITY, ID
3. The subset of a super key is a candidate key under what condition?
a) No proper subset is a super key
b) All subsets are super keys
c) Subset is a super key
d) Each subset is a super key
4. A _____ is a property of the entire relation, rather than of the individual tuples in which each
tuple is unique.
a) Rows
b) Key
c) Attribute
d) Fields
5. Which one of the following attribute can be taken as a primary key?
a) Name
b) Street
c) Id
d) Department
6. Which one of the following cannot be taken as a primary key?
a) Id
b) Register number
c) Dept_id
d) Street
7. An attribute in a relation is a foreign key if the _______ key from one relation is used as an
attribute in that relation.
a) Candidate
b) Primary
c) Super
d) Sub
8. The relation with the attribute which is the primary key is referenced in another relation. The
relation which has the attribute as a primary key is called ______________
a) Referential relation
b) Referencing relation
c) Referenced relation
d) Referred relation
9. The ______ is the one in which the primary key of one relation is used as a normal attribute in
another relation.
a) Referential relation
b) Referencing relation
c) Referenced relation
d) Referred relation
10. A _________ integrity constraint requires that the values appearing in specified attributes of any
tuple in the referencing relation also appear in specified attributes of at least one tuple in the
referenced relation.
a) Referential
b) Referencing
c) Specific
d) Primary
Relational algebra
1. Relational Algebra is a __________ query language that takes two relations as input and produces
another relation as an output of the query.
a) Relational
b) Structural
c) Procedural
d) Fundamental
2. Which of the following is a fundamental operation in relational algebra?
a) Set intersection
b) Natural join
c) Assignment
d) None of the mentioned
3. Which of the following is used to denote the selection operation in relational algebra?
a) Pi (Greek)
b) Sigma (Greek)
c) Lambda (Greek)
d) Omega (Greek)
4. For select operation the ________ appear in the subscript and the ___________ argument appears
in the paranthesis after the sigma.
a) Predicates, relation
b) Relation, Predicates
c) Operation, Predicates
d) Relation, Operation
5. The ___________ operation, denoted by −, allows us to find tuples that are in one relation but are
not in another.
a) Union
b) Set-difference
c) Difference
d) Intersection
6. Which is a unary operation:
a) Selection operation
b) Primitive operation
c) Projection operation
d) Generalized selection
7. Which is a join condition contains an equality operator:
a) Equijoins
b) Cartesian
c) Natural
d) Left
8. In precedence of set operators, the expression is evaluated from
a) Left to left
b) Left to right
c) Right to left
d) From user specification
9. Which of the following is not outer join?
a) Left outer join
b) Right outer join
c) Full outer join
d) All of the mentioned
10. The assignment operator is denoted by
a) ->
b) <-
c) =
d) ==
Calculas
1. Find the ID, name, dept name, salary for instructors whose salary is greater than $80,000 .
a) {t | t ε instructor ∧ t[salary] > 80000}
b) Э t ∈ r (Q(t))
c) {t | Э s ε instructor (t[ID] = s[ID]∧ s[salary] > 80000)}
d) None of the mentioned
2. A query in the tuple relational calculus is expressed as:
a) {t | P() | t}
b) {P(t) | t }
c) {t | P(t)}
d) All of the mentioned
3.
8. Find the names of all instructors in the Physics department together with the course id of all
courses they teach:
a)
∧s = “Fall” ∧ y = “2009”
∧s = “Spring” ∧ y = “2010”
b)
{< n, c > | Э i, a (< i, c, a, s, y > ε teaches
c)
d)
Er model
1. An ________ is a set of entities of the same type that share the same properties, or attributes.
a) Entity set
b) Attribute set
c) Relation set
d) Entity model
2. Entity is a _________
a) Object of relation
b) Present working model
c) Thing in real world
d) Model of relation
3. The descriptive property possessed by each entity set is _________
a) Entity
b) Attribute
c) Relation
d) Model
4. The function that an entity plays in a relationship is called that entity’s _____________
a) Participation
b) Position
c) Role
d) Instance
5. The attribute name could be structured as an attribute consisting of first name, middle initial,
and last name. This type of attribute is called
a) Simple attribute
b) Composite attribute
c) Multivalued attribute
d) Derived attribute
6. The attribute AGE is calculated from DATE_OF_BIRTH. The attribute AGE is
a) Single valued
b) Multi valued
c) Composite
d) Derived
7. Not applicable condition can be represented in relation entry as
a) NA
b) 0
c) NULL
d) Blank Space
8. Which of the following can be a multivalued attribute?
a) Phone_number
b) Name
c) Date_of_birth
d) All of the mentioned
9. Which of the following is a single valued attribute
a) Register_number
b) Address
c) SUBJECT_TAKEN
d) Reference
10. In a relation between the entities the type and condition of the relation should be specified.
That is called as______attribute.
a) Desciptive
b) Derived
c) Recursive
d) Relative
Constraints
1. _____________ express the number of entities to which another entity can be associated via a
relationship set.
a) Mapping Cardinality
b) Relational Cardinality
c) Participation Constraints
d) None of the mentioned
2. An entity in A is associated with at most one entity in B, and an entity in B is associated with at
most one entity in A.This is called as
a) One-to-many
b) One-to-one
c) Many-to-many
d) Many-to-one
3. An entity in A is associated with at most one entity in B. An entity in B, however, can be
associated with any number (zero or more) of entities in A.
a) One-to-many
b) One-to-one
c) Many-to-many
d) Many-to-one
4. Data integrity constraints are used to:
a) Control who is allowed access to the data
b) Ensure that duplicate records are not entered into the table
c) Improve the quality of data entered for a specific property
d) Prevent users from changing the values stored in the table
5. Establishing limits on allowable property values, and specifying a set of acceptable, predefined
options that can be assigned to a property are examples of:
a) Attributes
b) Data integrity constraints
c) Method constraints
d) Referential integrity constraints
6. 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) Then entering an order quantity, the user must input a number and not some text (i.e., 12
rather than ‘a dozen’)
7. ______ is a special type of integrity constraint that relates two relations & maintains consistency
across the relations.
a) Entity Integrity Constraints
b) Referential Integrity Constraints
c) Domain Integrity Constraints
d) Domain Constraints
8. Which one of the following uniquely identifies the elements in the relation?
a) Secondary Key
b) Primary key
c) Foreign key
d) Composite key
9. Drop Table cannot be used to drop a table referenced by a _________ constraint.
a) Local Key
b) Primary Key
c) Composite Key
d) Foreign Key
10. ____________ is preferred method for enforcing data integrity
a) Constraints
b) Stored Procedure
c) Triggers
d) Cursors
Diagram
1. Which one of the following can be treated as a primary key in teaches relation?
a) Id
b) Semester
c) Sec_id
d) Year
2. The primary key in the section relation is
a) Course_id
b) Sec_id
c) Both Course_id and Sec_id
d) All the attributes
3.
Which of the following has an error in the above create table for the relation section
a) Primary key (course id, sec id, semester, year)
b) Foreign key (course id) references course
c) Year numeric (4,0)
d) Building numeric (15)
7. The relation with primary key can be created using
a) Create table instructor (Id, Name)
b) Create table instructor (Id, Name, primary key(name))
c) Create table instructor (Id, Name, primary key (Id))
d) Create table instructor ( Id unique, Name )
8. How can the values in the relation teaches be deleted?
a) Drop table teaches;
b) Delete from teaches;
c) Purge table teaches;
d) Delete from teaches where Id =’Null’;
9. In the above teaches relation ” Select * from teaches where Year = ‘2010’” displays how many
rows?
a) 2
b) 4
c) 5
d) 1
10. The relation changes can be got back using ________ command.
a) Flashback
b) Purge
c) Delete
d) Getback
1. The entity set person is classified as student and employee. This process is called _________
a) Generalization
b) Specialization
c) Inheritance
d) Constraint generalization
2. Which relationship is used to represent a specialization entity?
a) ISA
b) AIS
c) ONIS
d) WHOIS
3. The refinement from an initial entity set into successive levels of entity subgroupings
represents a ________ design process in which distinctions are made explicit.
a) Hierarchy
b) Bottom-up
c) Top-down
d) Radical
4. There are similarities between the instructor entity set and the secretary entity set in the sense
that they have several attributes that are conceptually the same across the two entity sets:
namely, the identifier, name, and salary attributes. This process is called
a) Commonality
b) Specialization
c) Generalization
d) Similarity
5. If an entity set is a lower-level entity set in more than one ISA relationship, then the entity set
has
a) Hierarchy
b) Multilevel inheritance
c) Single inheritance
d) Multiple inheritance
6. A _____________ constraint requires that an entity belong to no more than one lower-level entity
set.
a) Disjointness
b) Uniqueness
c) Special
d) Relational
7. Consider the employee work-team example, and assume that certain employees participate in
more than one work team. A given employee may therefore appear in more than one of the team
entity sets that are lower level entity sets of employee. Thus, the generalization is _____________
a) Overlapping
b) Disjointness
c) Uniqueness
d) Relational
8. The completeness constraint may be one of the following: Total generalization or
specialization, Partial generalization or specialization. Which is the default?
a) Total
b) Partial
c) Should be specified
d) Cannot be determined
9. Functional dependencies are a generalization of
a) Key dependencies
b) Relation dependencies
c) Database dependencies
d) None of the mentioned
10. Which of the following is another name for a weak entity?
a) Child
b) Owner
c) Dominant
d) All of the mentioned
DDL
(100202,Drake,Biology,30000)
DML
This set of Database Questions & Answers focuses on “Querying database part-1 DML”
The instructor relation
1. Which of the following command is used to display the departments of the instructor relation?
a) Select * from instructor where Dept_name = Finance;
b) Select * from instructor ;
c) Select dept_name from instructor;
d) Select dept_name for instructor where Name=Jackson;
2. How can we select the elements which have common Dept_name in both the relation ?
a) Select * from instructor i , course c where i.Dept_name=c.Dept_name;
b) Select Dept name from instructor ,Course ;
c) Select * from instructor i , course c ;
d) Select Dept_name from instructor where Dept_name = NULL;
3. Select distinct Dept_name from instructor ;
How many row(s) are displayed ?
a) 4
b) 3
c) 5
d) Error
4. Suppose the Authority want to include a new instructor for the title Neuroscience what
command should be inserted ?
a) Insert into instructor values(12111,Emma,NeuroScience,200000);
b) Insert into course values(12111,Introduction,NeuroScience,2);
c)
What will be displayed as the value of name for the above query?
a) Hayley
b) Jackson
c) Hayley and Crick
d) Crick
7.
SELECT Name
FROM instructor
WHERE salary > SOME (SELECT salary FROM instructor WHERE dept_name = 'Comp.Sci.');
SELECT Name
FROM instructor
WHERE Name LIKE ’A%;
b)
SELECT Name
FROM course
WHERE Name LIKE ’A%;
c)
SELECT Dept_name
FROM instructor
WHERE Name LIKE ’A%;
d)
SELECT Name
FROM instructor
WHERE Dept_name LIKE ’A%;
For any pincode, there is only one city and state. Also, for given street, city and state, there is just
one pincode. In normalization terms, empdt1 is a relation in
a) 1 NF only
b) 2 NF and hence also in 1 NF
c) 3NF and hence also in 2NF and 1NF
d) BCNF and hence also in 3NF, 2NF and 1NF
1. We can use the following three rules to find logically implied functional dependencies. This
collection of rules is called
a) Axioms
b) Armstrong’s axioms
c) Armstrong
d) Closure
2. Which of the following is not Armstrong’s Axiom?
a) Reflexivity rule
b) Transitivity rule
c) Pseudotransitivity rule
d) Augmentation rule
3. The relation employee(ID,name,street,Credit,street,city,salary) is decomposed into
I.SELECT ee.empID
FROM Emps ee, Emps ff
WHERE ee.mgrID = ff.empID AND ff.mgrID = 123;
II.SELECT empID
FROM Emps
WHERE mgrID IN
(SELECT empID FROM Emps WHERE mgrID = 123);
Which, if any, of the two queries above will correctly (in SQL2) get the desired set of employee
ID’s?
a) Both I and II
b) I only
c) II only
d) Neither I nor I
8. Suppose relation R(A,B) currently has tuples {(1,2), (1,3), (3,4)} and relation S(B,C) currently has
{(2,5), (4,6), (7,8)}. Then the number of tuples in the result of the SQL query:
<i>SELECT *
FROM R NATURAL OUTER JOIN S; </i>IS:
a) 2
b) 4
c) 6
d) None of the mentioned
9. Suppose now that R(A,B) and S(A,B) are two relations with r and s tuples, respectively (again,
not necessarily distinct). If m is the number of (not necessarily distinct) tuples in the result of the
SQL query:
R intersect S;
Then which of the following is the most restrictive, correct condition on the value of m?
a) m = min(r,s)
b) 0 <= m <= r + s
c) min(r,s) <= m <= max(r,s)
d) 0 <= m <= min(r,s)
10. Suppose relation R(A,B,C,D,E) has the following functional dependencies:
A -> B
B -> C
BC -> A
A -> D
E -> A
D -> E
F1->F3
F2->F4
(F1,F2)->F5
AB->CD
DE->P
C->E
P->C
B->G
1. The normal form which satisfies multivalued dependencies and which is in BCNF is
a) 4 NF
b) 3 NF
c) 2 NF
d) All of the mentioned
2. Which of the following is a tuple-generating dependencies?
a) Functional dependency
b) Equality-generating dependencies
c) Multivalued dependencies
d) Non-functional dependency
3. The main task carried out in the __________ is to remove repeating attributes to separate tables.
a) First Normal Form
b) Second Normal Form
c) Third Normal Form
d) Fourth Normal Form
Transaction
1. Consider money is transferred from (1)account-A to account-B and (2) account-B to account-A.
Which of the following form a transaction?
a) Only 1
b) Only 2
c) Both 1 and 2 individually
d) Either 1 or 2
2. A transaction is delimited by statements (or function calls) of the form __________
a) Begin transaction and end transaction
b) Start transaction and stop transaction
c) Get transaction and post transaction
d) Read transaction and write transaction
3. Identify the characteristics of transactions
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
4. Which of the following has “all-or-none” property?
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
5. The database system must take special actions to ensure that transactions operate properly
without interference from concurrently executing database statements. This property is referred
to as
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
6. The property of a transaction that persists all the crashes is
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
7. __________ states that only valid data will be written to the database.
a) Consistency
b) Atomicity
c) Durability
d) Isolation
8. Transaction processing is associated with everything below except
a) Producing detail summary or exception reports
b) Recording a business activity
c) Confirming an action or triggering a response
d) Maintaining a data
9. The Oracle RDBMS uses the ____ statement to declare a new transaction start and its
properties.
a) BEGIN
b) SET TRANSACTION
c) BEGIN TRANSACTION
d) COMMIT
10. ____ means that the data used during the execution of a transaction cannot be used by a
second transaction until the first one is completed.
a) Consistency
b) Atomicity
c) Durability
d) Isolation
1. A transaction may not always complete its execution successfully. Such a transaction is termed
a) Aborted
b) Terminated
c) Closed
d) All of the mentioned
2. If an transaction is performed in a database and committed, the changes are taken to the
previous state of transaction by
a) Flashback
b) Rollback
c) Both Flashback and Rollback
d) Cannot be done
3. Each modification done in database transaction are first recorded into the
a) Harddrive
b) Log
c) Disk
d) Datamart
4. When the transaction finishes the final statement the transaction enters into
a) Active state
b) Committed state
c) Partially committed state
d) Abort state
5. The name of the transaction file shall be provided by the operator and the file that contains the
edited transactions ready for execution shall be called
a) Batch. Exe
b) Trans. Exe
c) Opt. Exe
d) Edit.Exe
6. Which of the following is an atomic sequence of database actions?
a) Transaction
b) Concurrency
c) Relations
d) All of the mentioned
7. 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) Atomic state
d) Inconsistent state
8. _______ 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
9. DBMS periodically suspends all processing and synchronizes its files and journals through the
use of
a) Checkpoint facility
b) Backup facility
c) Recovery manager
d) Database change log
10. Which of the following is not a state in transaction?
a) Active
b) Terminated
c) Aborted
d) Partially committed
Indexing
1. In ordered indices the file containing the records is sequentially ordered, a ___________ is an
index whose search key also defines the sequential order of the file.
a) Clustered index
b) Structured index
c) Unstructured index
d) Nonclustered index
2. Indices whose search key specifies an order different from the sequential order of the file are
called ___________ indices.
a) Nonclustered
b) Secondary
c) All of the mentioned
d) None of the mentioned
3. An ____________ consists of a search-key value and pointers to one or more records with that
value as their search-key value.
a) Index entry
b) Index hash
c) Index cluster
d) Index map
4. In a _______ clustering index, the index record contains the search-key value and a pointer to
the first data record with that search-key value and the rest of the records will be in the
sequential pointers.
a) Dense
b) Sparse
c) Straight
d) Continuous
5. In a __________ index, an index entry appears for only some of the search-key values.
a) Dense
b) Sparse
c) Straight
d) Continuous
6. Incase the indices values are larger, index is created for these values of the index. This is called
a) Pointed index
b) Sequential index
c) Multilevel index
d) Multiple index
7. A search key containing more than one attribute is referred to as a _________ search key.
a) Simple
b) Composite
c) Compound
d) Secondary
8. In B+ tree the node which points to another node is called
a) Leaf node
b) External node
c) Final node
d) Internal node
9. Insertion of a large number of entries at a time into an index is referred to as __________ of the
index.
a) Loading
b) Bulk insertion
c) Bulk loading
d) Increase insertion
10. While inserting the record into the index, if the search-key value does not appear in the index.
a) The system adds a pointer to the new record in the index entry
b) The system places the record being inserted after the other records with the same search-key
values
c) The system inserts an index entry with the search-key value in the index at the appropriate
position
d) None of the mentioned
Query processing
SQL
1. 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
2. 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
3.
1.
Name
Annie
Bob
Callie
Derek
Which of these query will display the the table given above ?
a) Select employee from name
b) Select name
c) Select name from employee
d) Select employee
2. Here which of the following displays the unique values of the column?
FROM instructor;
a) All
b) From
c) Distinct
d) Name
3. The ______ clause allows us to select only those rows in the result relation of the ____ clause that
satisfy a specified predicate.
a) Where, from
b) From, select
c) Select, from
d) From, where
4. The query given below will not give an error. Which one of the following has to be replaced to
get the desired output?
a) Salary*1.1
b) ID
c) Where
d) Instructor
5. The ________ clause is used to list the attributes desired in the result of a query.
a) Where
b) Select
c) From
d) Distinct
6. This Query can be replaced by which one of the following?
a) Table
b) Values
c) Relation
d) Field
1.
SELECT emp_name
FROM department
WHERE dept_name LIKE ’ _____ Computer Science’;
Which one of the following has to be added into the blank to select the dept_name which has
Computer Science as its ending string?
a) %
b) _
c) ||
d) $
4. ’_ _ _ ’ matches any string of ______ three characters. ’_ _ _ %’ matches any string of at ______
three characters.
a) Atleast, Exactly
b) Exactly, Atleast
c) Atleast, All
d) All, Exactly
5.
SELECT name
FROM instructor
WHERE dept name = ’Physics’
ORDER BY name;
SELECT *
FROM instructor
ORDER BY salary ____, name ___;
To display the salary from greater to smaller and name in ascending order which of the following
options should be used?
a) Ascending, Descending
b) Asc, Desc
c) Desc, Asc
d) Descending, Ascending
7.
SELECT name
FROM instructor
WHERE salary <= 100000 AND salary >= 90000;
SELECT name
FROM instructor
WHERE salary BETWEEN 90000 AND 100000;
b)
SELECT name
FROM employee
WHERE salary <= 90000 AND salary>=100000;
c)
SELECT name
FROM employee
WHERE salary BETWEEN 90000 AND 100000;
d)
SELECT name
FROM instructor
WHERE salary BETWEEN 100000 AND 90000;
8.
SELECT instructor.*
FROM instructor, teaches
WHERE instructor.ID= teaches.ID;
(SELECT course id
FROM SECTION
WHERE semester = ’Fall’ AND YEAR= 2009)
EXCEPT
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010);
a) i-only
b) ii-only
c) i & ii
d) None of the mentioned
7. The number of attributes in relation is called as its
a) Cardinality
b) Degree
c) Tuples
d) Entity
8. _____ clause is an additional filter that is applied to the result.
a) Select
b) Group-by
c) Having
d) Order by
9. _________ joins are SQL server default
a) Outer
b) Inner
c) Equi
d) None of the mentioned
10. The _____________ is essentially used to search for patterns in target string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
1. 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
2. If the attribute phone number is included in the relation all the values need not be entered into
the phone number column. This type of entry is given as
a) 0
b) –
c) Null
d) Empty space
3. The predicate in a where clause can involve Boolean operations such as and. The result of true
and unknown is_______ false and unknown is _____ while unknown and unknown is _____
a) Unknown, unknown, false
b) True, false, unknown
c) True, unknown, unknown
d) Unknown, false, unknown
4.
SELECT name
FROM instructor
WHERE salary IS NOT NULL;
Selects
Some of these insert statements will produce an error. Identify the statement.
a) Insert into employee values (1005,Rach,0);
b) Insert into employee values (1002,Joey,335);
c) Insert into employee values (1007,Ross, );
d) None of the mentioned
8. The primary key must be
a) Unique
b) Not null
c) Both Unique and Not null
d) Either Unique or Not null
9. You attempt to query the database with this command:
Why does this statement cause an error when QUANTITY values are null?
a) The expression attempts to divide by a null value
b) The data types in the conversion function are incompatible
c) The character string none should be enclosed in single quotes (‘ ‘)
d) A null value used in an expression cannot be converted to an actual value
10. The result of _____unknown is unknown.
a) Xor
b) Or
c) And
d) Not
1. 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 Collection of values & Single value
2.
SELECT __________
FROM instructor
WHERE dept name= ’Comp. Sci.’;
Which of the following should be used to find the mean of the salary ?
a) Mean(salary)
b) Avg(salary)
c) Sum(salary)
d) Count(salary)
3.
SELECT COUNT (____ ID)
FROM teaches
WHERE semester = ’Spring’ AND YEAR = 2010;
If we do want to eliminate duplicates, we use the keyword ______in the aggregate expression.
a) Distinct
b) Count
c) Avg
d) Primary key
4. All aggregate functions except _____ ignore null values in their input collection.
a) Count(attribute)
b) Count(*)
c) Avg
d) Sum
5. A Boolean data type that can take values true, false, and________
a) 1
b) 0
c) Null
d) Unknown
6. The ____ connective tests for set membership, where the set is a collection of values produced
by a select clause. The ____ connective tests for the absence of set membership.
a) Or, in
b) Not in, in
c) In, not in
d) In, or
7. 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)
b)
c)
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
d)
SELECT course id
FROM SECTION AS S
WHERE semester = ’Fall’ AND YEAR= 2009 AND
EXISTS (SELECT *
FROM SECTION AS T
WHERE semester = ’Spring’ AND YEAR= 2010 AND
S.course id= T.course id);
b)
SELECT name
FROM instructor
WHERE salary > SOME (SELECT salary
FROM instructor
WHERE dept name = ’Biology’);
c)
d)
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
10. 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
1.
In the query given above which one of the following is a temporary relation?
a) Budget
b) Department
c) Value
d) Max_budget
7. Subqueries cannot:
a) Use group by or group functions
b) Retrieve data from a table different from the one in the outer query
c) Join tables
d) Appear in select, update, delete, insert statements.
8. Which of the following is not an aggregate function?
a) Avg
b) Sum
c) With
d) Min
9. The EXISTS keyword will be true if:
a) Any row in the subquery meets the condition only
b) All rows in the subquery fail the condition only
c) Both of these two conditions are met
d) Neither of these two conditions is met
10. How can you find rows that do not match some specified condition?
a) EXISTS
b) Double use of NOT EXISTS
c) NOT EXISTS
d) None of the mentioned
b)
c)
INSERT INTO course VALUES (’CS-437’, ’DATABASE Systems’, ’Comp. Sci.’, 4);
d) Not possible
5. 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)
c)
UPDATE instructor
_____ salary= salary * 1.05;
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
UPDATE instructor
SET salary = salary * 1.03
WHERE salary > 100000;
UPDATE instructor
SET salary = salary * 1.05
WHERE salary <= 100000;
b)
UPDATE instructor
SET salary = salary * 1.05
WHERE salary < (SELECT avg (salary)
FROM instructor);
c)
UPDATE instructor
SET salary = CASE
WHEN salary <= 100000 THEN salary * 1.03
ELSE salary * 1.05
END
SELECT *
FROM student JOIN takes USING (ID);
SELECT *
FROM student INNER JOIN takes USING (ID);
b)
SELECT *
FROM student OUTER JOIN takes USING (ID);
c)
SELECT *
FROM student LEFT OUTER JOIN takes USING (ID);
TRANSACTION.....
Commit;
ROLLBACK;
Inorder to ensure that the value of budget is non-negative which of the following should be used?
a) Check(budget>0)
b) Check(budget<0)
c) Alter(budget>0)
d) Alter(budget<0)
5. 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
6.
Which of the following is used to delete the entries in the referenced table when the tuple is
deleted in course table?
a) Delete
b) Delete cascade
c) Set null
d) All of the mentioned
7. Domain constraints, functional dependency and referential integrity are special forms of
_________
a) Foreign key
b) Primary key
c) Assertion
d) Referential constraint
8. Which of the following is the right syntax for the assertion?
a) Create assertion ‘assertion-name’ check ‘predicate’;
b) Create assertion check ‘predicate’ ‘assertion-name’;
c) Create assertions ‘predicates’;
d) All of the mentioned
9. Data integrity constraints are used to:
a) Control who is allowed access to the data
b) Ensure that duplicate records are not entered into the table
c) Improve the quality of data entered for a specific property (i.e., table column)
d) Prevent users from changing the values stored in the table
10. 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’)
Here which one denotes the relation for which index is created?
a) StudentID_index
b) ID
c) StudentID
d) Student
4. Which of the following is used to store movie and image files?
a) Clob
b) Blob
c) Binary
d) Image
5. The user defined data type can be created using
a) Create datatype
b) Create data
c) Create definetype
d) Create type
6. Values of one type can be converted to another domain using which of the following?
a) Cast
b) Drop type
c) Alter type
d) Convert
7.
In order to ensure that an instructor’s salary domain allows only values greater than a specified
value use:
a) Value>=30000.00
b) Not null;
c) Check(value >= 29000.00);
d) Check(value)
8. Which of the following closely resembles Create view?
a) Create table . . .like
b) Create table . . . as
c) With data
d) Create view as
9. In contemporary databases, the top level of the hierarchy consists of ______ each of which can
contain _____
a) Catalogs, schemas
b) Schemas, catalogs
c) Environment, schemas
d) Schemas, Environment
10. Which of the following statements creates a new table temp instructor that has the same
schema as an instructor.
a) create table temp_instructor;
b) Create table temp_instructor like instructor;
c) Create Table as temp_instructor;
d) Create table like temp_instructor;
1. The database administrator who authorizes all the new users, modifies the database and takes
grants privilege is
a) Super user
b) Administrator
c) Operator of operating system
d) All of the mentioned
2. Which of the following is a basic form of grant statement?
a)
b)
c)
d)
b)
c)