You are on page 1of 33

SQL processing and client interfaces

• The SQL language is used to ”talk” to


relational databases like Oracle.
• Will discuss how the Oracle server processes
SQL statements.
SQL Processing
SQL Processing
• Oracle SQL processing is done in generally
three steps via the client/server interface;
• SQL statements are sent to the server, are being
executed at the server and results are sent back
to the client.
• For optimization, the number of roundtrips
between the server and the client should be
limited, as each roundtrip incurs a network
message or a process switch if the client and the
server runs on the same computer.
The parse step
• To execute SQL statement, it must be found in the
Library Cache of the SGA, and must be prepared for
execution.
• The SQL statement is sent to the server, which first
tries to identify an identical statement in the cache;
• If one is found, a soft parse is executed, which mainly
does a verification of access rights.
• If the SQL statement is not found, a hard parse is done,
which includes actual parsing and optimization of the
statement.
• The hard parse can be time consuming.
The execute step
• After parsing, the client instructs the server to
execute the SQL statement.
• This step can be repeated, which means that a
SQL statement can be parsed once and
executed several times.
• Heavily reduce the overhead by parsing.
The fetch step
• If the SQL statement is a query, the rows that
are the result are sent to the client during this
step.
MCQ Sample questions
• In the __________ normal form, a composite attribute is
converted to individual attributes.
A. First B. Second C. Third D. Fourth

• Which-one ofthe following statements about normal forms is


FALSE?
A. BCNF is stricter than 3 NF
B. Lossless, dependency -preserving decomposition into 3
NF is always possible
C. Loss less, dependency – preserving decomposition into
BCNF is always possible
D. Any relation with two attributes is BCNF View Answer
MCQ Sample questions
• A table has fields F1, F2, F3, F4, and F5, with
the following functional dependencies:
– F1->F3
– F2->F4
– (F1,F2)->F5
in terms of normalization, this table is in
(a) 1NF (b) 2NF (c) 3NF (d)
None of these
MCQ Sample questions
• Which of the following is TRUE?
(a) Every relation in 2NF is also in BCNF
(b) A relation R is in 3NF if every non-prime
attribute of R is fully functionally dependent on
every key of R
(c) Every relation in BCNF is also in 3NF
(d) No relation can be in both BCNF and 3NF
MCQ Sample questions
• Consider a relation R(A,B,C,D,E) with the
following dependencies:
– {AB-> C, CD -> E, DE -> B}
• Is AB a candidate key of this relation? If not,
is ABD? Explain your answer.
MCQ Sample questions
• Consider a relation with schema R(A,B,C,D)
and FDs {AB -> C, C -> D, D -> A}.
• What are all candidate keys of R?
MCQ Sample questions
• Compute the closure of the following set F of
functional dependencies for relation schema R
= {A, B, C, D, E}.
– A -> BC
– CD -> E
– B -> D
– E -> A
• List the candidate keys for R.
MCQ Sample questions
• Which of the following relational algebra
operations do not require the participating
tables to be union-compatible?
(A) Union (B) Intersection (C) Difference (D)
Join
MCQ Sample questions
• The language that requires a user to specify
the data to be retrieved without specifying
exactly how to get it is
(A) Procedural DML. (B) Non-Procedural DML.
(C) Procedural DDL. (D) Non-Procedural
DDL.
MCQ Sample questions
• The rule that a value of a foreign key must
appear as a value of some specific table is
called a
(A) Referential constraint. (B) Index.
(C) Integrity constraint. (D) Functional
dependency.
MCQ Sample questions
• The clause in SQL that specifies that the query
result should be sorted in ascending or
descending order based on the values of one or
more columns is
(A) View (B) Order by (C) Group by (D)
Having
MCQ Sample questions
• What are the desirable properties of a
decomposition
(A)Partition constraint. (B) Dependency
preservation. (C) Redundancy. (D)
Security.
• In an E-R diagram double lines indicate
(A) Total participation. (B) Multiple
participation. (C) Cardinality N. (D) None of
the above.
MCQ Sample questions
• Fifth Normal form is concerned with
(A)Functional dependency. (B) Multivalued
dependency. (C) Join dependency. (D)
Domain-key.
• In SQL the statement select * from R, S is
equivalent to
(A) Select * from R natural join S. (B) Select *
from R cross join S. (C) Select * from R union
join S. (D) Select * from R inner join S.
MCQ Sample questions
• DROP is a ______________ statement in
SQL.
(A) Query (B) Embedded SQL (C) DDL (D)
DCL
• If two relations R and S are joined, then the
non matching tuples of both R and S are
ignored in
(A) left outer join (B) right outer join (C) full
outer join (D) inner join
MCQ Sample questions
• In 2NF
(A) No functional dependencies (FDs) exist.
(B) No multivalued dependencies (MVDs) exist.
(C) No partial FDs exist.
(D) No partial MVDs exist.
• A functional dependency of the form x → y is
trivial if :
• y ⊆ x(B) x ⊂ y (C) x ⊆ y(D) y ⊂ x
MCQ Sample questions
• The normalization was first proposed by
______________.
(A)Code (B) Codd (C) Boyce Codd (D)
Boyce
• In E-R Diagram total participation is
represented by
(A) double lines (B) Dashed lines (C) single
line (D) Triangle
MCQ Sample questions
• The FD A → B , DB → C implies
(A)DA → C (B) A → C (C) B → A (D) DB → A
• Union operator is a :
(A)Unary Operator (B) Ternary Operator (C)
Binary Operator (D) Not an operator
• The values of the attribute describes a
particular_____________
(A) Entity set (B) File (C) Entity instance (D)
Organization
MCQ Sample questions
• If both the functional dependencies : X→Y
and Y→X hold for two attributes X and Y then
the relationship between X and Y is
(A)M:N (B) M:1 (C) 1:1 (D) 1:M
• A table can have only one
(A) Secondary key (B) Alternate key (C)
Unique key (D) Primary key
MCQ Sample questions
• Relational calculus is a
(A)Procedural language. (B) Non- Procedural
language. (C) Data definition language. (D)
High level language.
• Cartesian product in relational algebra is
(A) a Unary operator. (B) a Binary operator.
(C) a Ternary operator. (D) not defined.

MCQ Sample questions
• In a relational model, relations are termed as (A)
Tuples. (B) Attributes (C) Tables. (D) Rows.

• In an E-R diagram attributes are represented by


(A)rectangle. (B) square. (C) ellipse. (D) triangle.

• In case of entity integrity, the primary key may be

(A) not Null (B) Null (C) both Null & not Null. (D)
any value.
MCQ Sample questions
• Count function in SQL returns the number of
(A) values. (B) distinct values.
(C) groups. (D)
columns.
• The statement in SQL which allows to change
the definition of a table is
(A) Alter. (B) Update.
(C) Create. (D) select.
MCQ Sample questions
• 1. Which normal form is considered adequate for normal
relational database design?
(a) 2NF           (b) 5NF          (c) 4NF         (d) 3NF

• Consider a schema R(A, B, C, D) and functional dependencies A ->


B and C -> D. Then the decomposition of R into R1 (A, B) and R2(C,
D) is 
(a) dependency preserving and lossless join
(b) lossless join but not dependency preserving
(c) dependency preserving but not lossless join
(d) not dependency preserving and not lossless join
MCQ Sample questions
MCQ Sample questions
MCQ Sample questions

You might also like