Discussion; 03/10/2017 : DBMS

ER Model
-------------
Here are the geometric shapes and their meaning in an E-R Diagram –

Rectangle: Represents Entity sets.

Ellipses: Attributes

Diamonds: Relationship Set

Lines: They link attributes to Entity Sets and Entity sets to Relationship Set

Double Ellipses: Multivalued Attributes

Dashed Ellipses: Derived Attributes

Double Rectangles: Weak Entity Sets

Double Lines: Total participation of an entity in a relationship set

Embedded  SQL
--------------------/

It is the one which combines the high level language with the DB language like SQL. It allows the application languages to communicate with DB and get requested result. The high level languages which supports embedding SQLs within it are also known as host language. There are different host languages which support embedding SQL within it like C, C++, ADA, Pascal, FORTRAN, Java etc. When SQL is embedded within C or C++, then it is known as Pro*C/C++ or simply Pro*C language. Pro*C is the most commonly used embedded SQL. Let us discuss below embedded SQL with respect to C language.



Q.Which of the following gives a logical structure of the database graphically ?
a) Entity-relationship diagram
b) Entity diagram
c) Database diagram
d) Architectural representation

Answer: A


Keys
-------/
I'll take example of an Employee table:
Employee (
Employee ID,
FullName,
SSN,
DeptID
)

1. Candidate Key: are individual columns in a table that qualifies for uniqueness of all the rows. Here in Employee table EmployeeID & SSN are Candidate keys.

2. Primary Key: is the columns you choose to maintain uniqueness in a table. Here in Employee table you can choose either EmployeeID or SSN columns, EmployeeID is preferable choice, as SSN is a secure value.

3. Alternate Key: Candidate column other the Primary column, like if EmployeeID is PK then SSN would be the Alternate key.

4. Super Key: If you add any other column/attribute to a Primary Key then it become a super key, like EmployeeID + FullName is a Super Key.

5. Composite Key: If a table do not have any single column that qualifies for a Candidate key, then you have to select 2 or more columns to make a row unique. Like if there is no EmployeeID or SSN columns, then you can make FullName + DateOfBirth as Composite primary Key. But still there can be a narrow chance of duplicate row.


Q.Consider the attributes Id, city and name. Which one of this can be considered a superkey
a) Name
b) id
c) city
d) city, id

Answer: d


Q. Given the basic ER and relational models, which of the following is INCORRECT?

(a) An attribute of an entity can have more than one value

(b) An attribute of an entity can be composite

(c) In a row of a relational table, an attribute can have more than one value

(d) In a row of a relational table, an attribute can have exactly one value or a NULL value

Answer: C

Q. Third normal form is based on the concept of............                                
a)closure dependency       b)transitive dependency
c)normal dependency      d)functional dependency

Answer: B

Q.An entity set that does not have sufficient attributes to form a primary key is termed a __________
a) Strong entity set
b) Variant set
c) Weak entity set
d) Variable set

Answer; C

Comments