2. Data model tells how the logical structure of a database
is modeled. Data Models are fundamental entities to
introduce abstraction in DBMS. Data models define how
data is connected to each other and how it will be
processed and stored inside the system.
Hierarchical Model
Network Model
Relational Model
Explain about various data models used to
describe the design of a database?
3. Hierarchical Model
The hierarchical data model organizes data in a tree
structure.
One to many relationship.
The structure is based on the rule that one parent can
have many children but children are allowed only one
parent.
4. Network Model
Some data were more naturally modeled with more
than one parent per child. So, the network model
permitted the modelling of many-to-many
relationships in data.
5. Relational Model
It defines a database as a collection of tables
(relations) which contains all data. Each table has
multiple columns, and each column has a unique
name.
Properties of Relational Tables:
Values are atomic.
Each row is unique.
Column values are of the same kind.
The sequence of columns is insignificant.
The sequence of rows is insignificant.
Each column has a unique name.
6. Explain about the constraints in SQL?
SQL constraints are used to specify rules for the data in
table.
These constraints ensure database integrity and hence
they are often called database integrity constraints.
The following are the constraints:
NOT NULL
Column must always have a value.
It can never be null.
7. UNIQUE
No two rows can have the same value for the UNIQUE
KEY column or columns.
PRIMARY KEY
No two rows in the table can have the same value.
Primary key cannot contain a NULL value this constraint
must be defined only on the column defined as NOT
NULL.
DEFAULT
Using this constraint, a default value can be set for a
column, when the user does not enter a value for the
column.
CHECK
This constraint limits value that can be inserted into a
column of a table.
8. What is the difference between database
schema and a database instance?
The overall design of a data base is called a schema.
The collection of information stored in the database at a
particular moment is called instance of a database or database
state.
A database schema is corresponds to the variable declaration in
a program.
Each variable has a particular value at a given instant. The value
of variable in a program at a point in time correspond to an
instance of a database schema.
9. Explain about view and its advantages?
Any relation that is not part of the logical model, but is
made visible to a user as a virtual relation is called view.
A view is a relation that is derived from other relation . These
other relation could be a base relation or previously
defined view.
Advantages:
View mechanism is that it provide the support for the
logical data independence.
View are also valuable in the context of security.
Data integrity.
Shielding from change.
Easier querying.
10. Distinguish between primary key, composite
key and candidate key?
PRIMARY KEY
It is a candidate key that is used by the data base
designers for unique identification of each row in a
table.
It can be consist of one or more attribute.
Eg:- ID key is primary key.
11. CANDIDATE KEY
It is defined as minimal super key.
It is a combination of attribute that identifies the record
uniquely. But no one of it is proper subsets can identify
the records uniquely.
Eg: 1.ID
2.Name,address
12. COMPOSITE KEY
If we use multiple attribute to create a primary key then
that primary key is called composite key.
Also called compound key or concatenated key.
Eg:-If we have used second name , address as a
primary key then it will be our composite key.
13. What is meant by normalization?
Normalization is the process of decomposing
unsatisfactory bad relations by breaking up their
attributes to small relations.
NORMAL FORM
Condition using key & functional dependencies of a
relation to certify whether a relation schema is in a
particular normal form.
14. Explain the GROUP BY and HAVING clause
in SQL?
GROUP BY
GROUP BY is an optional clause in a query. It follows
WHERE clause or the FROM clause if the WHERE clause
is missing.
GROUP BY has the following general format:
GROUP BY column-1 [column-2]
Each group we consist of tuples that have the same
value of attribute called grouping attribute.
15. HAVING
The HAVING clause is associated with grouping queries
and aggregate queries.
It is optional in both case.
In grouping queries it follows the GROUP BY clause .
In aggregate queries HAVING clause follows the WHERE
clause or the FROM clause if the WHERE clause missing.
The HAVING clause has the following general format:
HAVING predicate
16. What are the purpose of database system?
Database management systems were developed to
handle the following difficulties of typical file-processing
systems supported by conventional operating systems:
Data redundancy and inconsistency
Difficulty in accessing data
Data isolation – multiple files and formats
Integrity problems
Atomicity of updates
Concurrent access by multiple users
Security problems