Beruflich Dokumente
Kultur Dokumente
Unit- I
Database System Architecture - Basic Concepts : Data System, Operational Data, Data
Independence, Architecture for a Database System, Distributed Databases, Storage Structures :
Representation of Data. Data Structures and Corresponding Operators: Introduction, Relation
Approach, Hierarchical Approach, Network Approach.
Unit - II
Relational Approach : Relational Data Structure : Relation, Domain, Attributes, Key Relational
Algebra - Introduction, Traditional Set Operation. Attribute Attribute names for derived
relations - Special Relational Operations.
Unit - III
Embedded SQL: Introduction – Operations not involving cursors, involving cursors – Dynamic
statements, Query by Example – Retrieval operations, Built-in Functions, update operations -
QBE Dictionary. Normalization : Functional dependency, First, Second, Third normal forms,
Relations with more than one candidate key, Good and bad decomposition.
Unit - IV
Hierarchical Approach : IMS data structure - Physical Database, Database Description-
Hierarchical sequence - External level of IMS : Logical Databases, the program communication
block IMS Data manipulation : Defining the Program communication Block : DL / 1 Examples.
Unit - V
Network Approach : Architecture of DBTG System. DBTG Data Structure : The set construct,
Singular sets, Sample Schema, the external level of DBTG – DBTG Data Manipulation.
REFERENCE BOOKS
1. C.J.Date - An introduction to Database Systems, Seventh Edition
2. Abraham Silberschatz, Henry F Korth- Database Systems Concepts
3. Bipin C Desai - An introduction to Database Systems
Unit- I
Database System Architecture - Basic Concepts: Data System, Operational Data, Data
Independence, Architecture for a Database System, Distributed Databases, Storage Structures:
Representation of Data. Data Structures And Corresponding Operators: Introduction, Relation
Approach, Hierarchical Approach, Network Approach.
DATABASE
Data - In computing, data is information or a raw fact that has been translated into a form
that is more convenient to move or process.
DataBase - A database is a collection of data that is organized so that its contents can easily
be accessed, managed, and updated.
DataBase Management System - A database management system (DBMS) is a software
package designed to define, manipulate, retrieve and manage data in a database.
BASIC CONCEPTS
DATA SYSTEM
DBMS contains information about a particular enterprise
Collection of interrelated data
set of programs to access the data
An environment that is both convenient and efficient to use.
Database Design
It is important to design the database in such a way that:
A specific item can be reached easily (maximum guarantee that the desired record will be
reached)
The database can respond to the user’s different questions easily
(necessary relationships are provided)
The database occupies minimum storage space (choosing data types and how to express a
certain concept is important)
The database contains no unnecessary data (storing the gross salary is enough, the net salary
can be calculated from the gross salary)
Data can be added and updated easily without causing mistakes
(no data redundancy)
Character
It is the most basic logical data element. It consists of a single alphabetic, numeric, or other
symbol.
Field
It consists of a grouping of characters. A data field represents an attribute (a characteristic or
quality) of some entity (object, person, place, or event).
Record
The related fields of data are grouped to form a record. Thus, a record represents a collection
of attributes that describe an entity. Fixed-length records contain, a fixed number of fixed-length
data fields. Variable-length records contain a variable number of fields and field lengths.
File
A group of related records is known as a data file, or table. Files are frequently classified by
the application for which they ar primarily used, such as a payroll file or an inventory file, or the
type of data they contain, such as a document file or a graphical image file. Files are also
classified by their permanence, for example, a master file versus a transaction file. A transaction
file would contain records of
all transactions occurring during a period, whereas a master file contains all the permanent
records. A history file is an obsolete transaction or master file retained for backup purposes or
for long-term historical storage called archival storage.
Database
It is an integrated collection of logically related records or objects. A database consolidates
records previously stored in separate files into a common pool of data records that provides data
for many applications. The data stored in a database is independent of the application programs
using it and o the ‘type of secondary storage devices on which it is stored.
CHARACTERISTICS OF DBMS
1. Self-contained nature
DBMS system contains data plus a full description of the data (called “metadata”)
“metadata” is data about data - data formats, record structures, locations, how to access, indexes
metadata is stored in a catalog and is used by DBMS software to know how to access the data.
Contrast this with the file processing approach where application programs need to know the
structure and format of records and data.
2. Program-data independence
Data independence is immunity of application programs to changes in storage structures and
access techniques. E.g. adding a new field, changing index structure, changing data format, In a
DBMS environment these changes are reflected in the catalog. Applications aren’t affected.
Traditional file processing programs would all have to
change, possibly substantially.
3. Data abstraction
A DBMS provides users with a conceptual representation of data (for example, as objects
with properties and inter-relationships). Storage details are hidden. Conceptual representation is
provided in terms of a data model.
DATABASE APPLICATIONS
banking: all transactions
airlines: reservations, schedules
universities: registration, grades
sales: customers, products, purchases
online retailers: order tracking, customized recommendations.
manufacturing: production, inventory, orders, supply chain
human resources: employee records, salaries, tax Deductions.
The interactions catered for by most existing DBMSs fall into four main groups:
Data definition – Defining new data structures for a database, removing data structures from
the database, modifying the structure of existing data.
Update – Inserting, modifying, and deleting data.
Retrieval – Obtaining information either for end-user queries and reports or for processing by
applications.
Administration – Registering and monitoring users, enforcing data security, monitoring
performance, maintaining data integrity, dealing with concurrency control, and recovering
information if the system fails.
TYPES OF DATABASES
Continuing developments in information technology and its business applications have
resulted in the evolution of several major types of databases. Several major conceptual
categories of databases that may be found in computer-using organizations include:
Operational Databases
The databases store detailed data needed to support the operations of the entire organization.
They are also called subject area databases (SADB), transaction databases, and production
databases: Examples are customer databases, personnel databases, inventory databases, and
other databases containing data generated by business operations.
Distributed Databases
Many organizations replicate and distribute copies or parts of databases to network
sewers at a variety of sites. These distributed databases can reside on network servers
on the World Wide Web, on corporate Intranets or extranets, or on other company networks.
Distributed databases may be copies of operational or analytical. databases,
hypermedia or discussion databases, or any other type of database. Replication and distribution
of databases is done to improve database performance and security.
External Databases
Access to external, privately owned online databases or data banks is available for a fee to
end users and organizations from commercial online services, and with or without charge from
many sources on the Internet, especially the Web.
Hypermedia Databases. It consists of hyperlinked pages of multimedia (text, graphics, and
photographic images, video clips, audio segments, etc
1. Data
As we have discussed above, data is raw hand information collected by us. Data is made up
of data item or data aggregate. A Data item is the smallest unit of named data: It may consist of
bits or bytes. A Data item is often referred to as field or data element. A Data aggregate is the
collection of data items within the record, which is given a name and referred as a whole. Data
can be collected orally or written. A database can be integrated and shared. Data stored in a
system is partition into one or two databases. So if by chance data lost or damaged at one place,
then it can be accessed from the second place by using the sharing facility of data base system.
So a shared data also cane be reused according to the user’s requirement. Also data must be in
the integrated form. Integration means data should be in unique form i.e. data collected by using
a well-defined manner with no redundancy, for example Roll number in a class is non-redundant
form and so these have unique resistance, but names in class may be in the redundant form and
can create lot of problems later on in using and accessing the data.
2. Hardware
Hardware is also a major and primary part of the database. Without hardware nothing can be
done. The definition of Hardware is “which we can touch and see”, i.e. it has physical
existences. All physical quantity or items are in this category. For example, all the hardware
input/output and storage devices like keyboard, mouse, scanner, monitor, storage devices (hard
disk, floppy disk, magnetic disk, and magnetic drum) etc. are commonly used with a computer
system.
3. Software
Software is another major part of the database system. It is the other side of hardware.
Hardware and software are two sides of a coin. They go side by side. Software is a system.
Software are further subdivided into two categories, First type is system software (like all the
operating systems, all the languages and system packages etc.) and second one is an application
software (payroll, electricity billing, hospital management and hostel administration etc.). We
can define software as which we cannot touch and see. Software only can execute. By using
software, data can be manipulated, organized and stored.
4. Users
Without user all of the above said components (data, hardware & software) are meaning less.
User can collect the data, operate and handle the hardware. Also operator feeds the data and
arranges the data in order by executing the software. Other components
1. People - Database administrator; system developer; end user.
2. CASE tools: Computer-aided Software Engineering (CASE) tools.
3. User interface - Microsoft Access; PowerBuilder.
4. Application Programs - PowerBuilder script language; Visual Basic; C++; COBOL.
5. Repository - Store definitions of data called METADATA, screen and report formats,
menu definitions, etc.
6. Database - Store actual occurrences data.
7. DBMS - Provide tools to manage all of this - create data, maintain data, control security
access to data and to the repository, etc.
Advantages of a DBMS
One of the major advantages of using a database system is that the organization
can be handled easily and have centralized management and control over the data by
the DBA. Some more and main advantages of database management system are given
below:
The main advantages of DBMS are
Data independence
Efficient data access
Data integrity & security
Data administration
Concurrent access, crash recovery
Reduced application development time
1. Controlling Redundancy
In a DBMS there is no redundancy (duplicate data). If any type of duplicate data arises, then
DBA can control and arrange data in non-redundant way. It stores the data on the basis of a
primary key, which is always unique key and have non-redundant information. For
example, Roll no is the primary key to store the student data.
In traditional file processing, every user group maintains its own files. Each group independently
keeps files on their db e.g., students. Therefore, much of the data is stored twice or more.
Redundancy leads to several problems:
2. Duplication of effort
Storage space wasted when the same data is stored repeatedly
Files that represent the same data may become inconsistent (since the updates are applied
independently by each users group).We can use controlled redundancy.
Restricting Unauthorized Access
A DBMS should provide a security and authorization subsystem.
Some db users will not be authorized to access all information in the db (e.g., financial data).
Some users are allowed only to retrieve data.
Some users are allowed both to retrieve and to update database.
Disadvantages of a DBMS
Database management system has many advantages, but due to some major problem
arise in using the DBMS, it has some disadvantages. These are explained as:
1.Cost
A significant disadvantage of DBMS is cost. In addition to the cost of purchasing or
developing the software, the organization *111 also purchase or upgrade the hardware
and so it becomes a costly system. Also additional cost occurs due to migration of data
from one environment of DBMS to another environment.
5. Data Quality
Since the database is accessible to users remotely, adequate controls are needed to control
users updating data and to control data quality. With increased number of users accessing data
directly, there are enormous opportunities for users to damage the data. Unless there are suitable
controls, the data quality may be compromised.
6. Data Integrity
Since a large number of users could be using .a database concurrently, technical safeguards
are necessary to ensure that the data remain correct during operation. The main threat to data
integrity comes from several different users attempting to update the same data at the same time.
The database therefore needs to be protected against inadvertent changes by the users.
7. Enterprise Vulnerability
Centralizing all data of an enterprise in one database may mean that the database becomes an
indispensable resource. The survival of the enterprise may depend on reliable information being
available from its database. The enterprise therefore becomes vulnerable to the destruction of the
database or to unauthorized modification of the database.
Analogies to the concepts of data types, variables and values in programming languages is
useful.
E.g. consider again the pascal example:
In declaring the type ‘customer’ – no variables are declared. To declare such variables, we write:
Var customer1: customer
Corresponds to an area of storage containing a ‘customer’ type record i.e. what all instances
declared in the customer type definition holds good for this instance also.
A database schema corresponds to the programming language ‘type’ definition of ‘pascal’ or
‘structure’ data type of C.
A variable of a given type has a particular value at a given instance. The value of a variable in
programming language corresponds to an ‘instance’ of a database schema.
Database systems have several schemas.
They are partitioned according to the levels of abstraction.
Lowest Level Physical Schema
Intermediate Level Logical Schema
Highest Level Subschema
In general, a database system – supports One Physical Schema. One Logical schema and several
sub schemas.
MODEL
Data Model is defined as “A collection of Conceptual Tools for (1) Describing Data, (2) Setting
Data Relationships (3) Setting the syntax and semantics for the data and (4) Setting up
Consistency Constraints.
The Various data models fall under 3 different Groups:
Object Based Logical Models
Record Based Logical Models
Physical Models
Object Based Logical Models
Used in describing the data at the ‘Logical’ and ‘View’ Level
They are characterized by the fact that they provide fairly flexible structuring capabilities and
allow data constraints to be specified explicitly.
Many different models falling under this category are:
Entity Relationship Model
Object Oriented Model
Semantic Data Model
Functional Data Model
ENTITY RELATIONSHIP MODEL
E-R model is based on the ‘perception’ of the ‘real world’ that consists of a collection of basic
objects, called ‘entities’ and of ‘relationships’ among those objects
An entity is a “thing” or “object” in the real world that is distinguishable from other objects.
e.g. Each person is an entity
Entities are described in a database by a ‘set of attributes’
A ‘Relationship’ is an association among several entities.
A set of all entities of the same type and set of all relationships of the same type is called ‘Entity
Set’ and ‘Relationship Set’. In addition to entities and relationships, the ER model represents
certain constraints to which the contents of database must conform.
“Mapping Cardinalities” is an important constraint which represents / expresses the no.of entities
to which another entity can be associated via a relationship set.
The overall logical structure of a database can be expressed graphically by an E-R diagram
which is built up from the following components.
----à Rectangles – Entity Sets
----à Ellipses – Attributes
----à Diamonds – relationships among the entity sets
----à Lines – link attributes to entity sets and entity sets to relationships.
OBJECT ORIENTED MODEL
Like the E-R model, the OO model is based on a ‘Collection of Objects’. An object contains
values stored in ‘Instance Variables’ within the object.
An object contains ‘Bodies of Code’ that operates on the object. These bodies of code are called
‘Methods’
Objects that contain the same type of values and same methods are grouped into ‘Classes’.
The only way in which one object can access the data of another object is ‘By invoking a
method’ of that other object.
Object DBMSs add database functionality to object programming languages. They bring much
more than persistent storage of programming language objects. Object DBMSs extend the
semantics of the C++, Smalltalk and Java object programming languages to provide full-featured
database programming capability, while retaining native language compatibility. A major benefit
of this approach is the unification of the application and database development into a seamless
data model and language environment. As a result, applications require less code, use more
natural data modeling, and code bases are easier to maintain. Object developers can write
complete database applications with a modest amount of additional effort.
According to Rao (1994), "The object-oriented database (OODB) paradigm is the combination
of object-oriented programming language (OOPL) systems and persistent systems. The power of
the OODB comes from the seamless treatment of both persistent data, as found in databases, and
transient data, as found in executing programs."
In contrast to a relational DBMS where a complex data structure must be flattened out to fit into
tables or joined together from those tables to form the in-memory structure, object DBMSs have
no performance overhead to store or retrieve a web or hierarchy of interrelated objects. This one-
to-one mapping of object programming language objects to database objects has two benefits
over other storage approaches: it provides higher performance management of objects, and it
enables better management of the complex interrelationships between objects. This makes object
DBMSs better suited to support applications such as financial portfolio risk analysis systems,
telecommunications service applications, world wide web document structures, design and
manufacturing systems, and hospital patient record systems, which have complex relationships
between data.
‘Sending a Message’ to the object. The instance variable and methods code are not visible
externally and hence these are the 2 levels of abstraction.
e.g.
Consider an object representing a bank account. The object contains ‘instance variables’ account
number and balance. It contains a ‘method’ – pay interest – which adds interest to that balance.
Assume that the bank is paying 6% interest on all accounts, but now changing the policy to pay
5% if the balance is < 1000 or 6% if the balance > 1000.
Under most data models, making this adjustment involves – changing codes in one or more
application programs.
Under the OO model, the only change is made within ‘pay interest’ method. The external
interface to objects remain unchanged.
The basic unit that an object-oriented (OO-DBMS) manages is the object. It is based on four
basic concepts of abstraction:
Classification: Mapping of several objects (instances) to common class
Generalization: Group several classes which have the same properties in common (roads,
railway)-transportation network.
Association: Relation between similar objects is considered a higher level set object
Aggregation: Objects which consist of several other objects (Composed objects)
OO model uses objects rather than records to manage data.An object is a collection of data
elements and operations that together are considered a single entity
An object has associated with it a set of variables that contain the data for the object, a set of
messages to which the object respond, and a method which response to the message.Once the
structure is setup, the details of it need not be user visible.This approach has the attraction that
query is very natural
Objects are typed and the format and operations of an object instance are the same as some
object prototype
Example of an object might be a lake:
List of border chain: C1, C2, C3, Cn
List of nodes: N1, N2, N3, Nn
Attribute: Depth, soil type
Object oriented Model Examples
Student
For example student can be a superclass. First and second year student may represented by a
classes that are specialization of a student class variables and methods specific to first year
students are associated with fist year student class.Variables and methods that apply both to first
and second year students are associated with student class.The variables associated with each
class may be:
Student: Name, ID, address
First year student: Subject
Second year student:Practical course
Relational model
The ER model is a conceptual data model that views the real world as entities and
relationships. A basic component of the model is the Entity-Relationship diagram, which is used
to visually represent data objects. Entity Relationship Diagram(ER Diagram) is used to
represent the requirement analysis at the conceptual design stage .The database is designed from
the ER Diagram or we can say that the ER digram is converted to the database. Each entity in
the ER diagram corresponds to a table in the database.The attributes of an entity corresponds to
fields of a tables.
For the database designer, the utility of the ER model is:
It maps well to the relational model. The constructs used in the ER model can easily be
transformed into relational tables.
It is simple and easy to understand with a minimum of training. Therefore, the model can be
used by the database designer to communicate the design to the end user.
In addition, the model can be used as a design plan by the database developer to implement a
data model in specific database management software.
Elements of E-R
A relational database consists of a collection of tables, each of which is assigned a unique
name.The relational models differs from network and hierarchical models in that it does not use
pointers or links. Instead , the relational model relate records by the value they contain.This
freedom from the use of pointers allows formal mathematical foundation to be defined
Examples of RDBMS are Oracle, Informix, and Sybase
Independence of the physical data storage and logical database structure. Results in users do not
need to understand the underlying physical layout of the data to access data from a logical
structure, such as a table.Variable and easy access to all data. Results in access to data is not
predefined as in hierarchical databases in which users must understand and navigate through the
hierarchy to retrieve data
Flexible in database design. i.e complex objects are expressed as simple tables and
relationships.Applying relational design methods reduces data redundancy (Normalization) and
storage requirements
Advantages and Disadvantages of E-R Data Model
Advantages of an E-R Model
Straightforward relation representation: Having designed an E-R diagram for a database
application, the relational representation of the database model becomes relatively
straightforward.
Easy conversion for E-R to other data model: Conversion from E-R diagram to a network or
hierarchical data model can· easily be accomplished.
Graphical representation for better understanding: An E-R model gives graphical and
diagrammatical representation of various entities, its attributes and relationships between
entities. This is turn helps in the clear understanding of the data structure and in minimizing
redundancy and other problems.
Disadvantages of an E-R Model:
No industry standard for notation: There is no industry standard notation for developing an E-
R diagram.
Popular for high-level design: The E-R data model is especially popular for high level.
HIERARCHICAL MODEL
A hierarchical database model is a data model in which the data is organized into atree-like
structure. The structure allows representing information using parent/child relationships: each
parent can have many children, but each child has only one parent (also known as a 1-to-many
relationship). All attributes of a specific record are listed under an entity type.
In a database an entity type is the equivalent of a table. Each individual record is represented as a
row, and each attribute as a column. Entity types are related to each other using 1:N mappings,
also known as one-to-many relationships. This model is recognized as the first database model
created by IBM in the 1960s.
A parent may have an arrow pointing to a child, but a child must have an arrow pointing to
its parent. Database schema is represented as a collection of tree-structure diagrams.
single instance of a database tree
The root of this tree is a dummy node
The children of that node are actual instances of the appropriate record type
When transforming E-R diagrams to corresponding tree-structure diagrams, we must ensure
that the resulting diagrams are in the form of rooted trees.
A hierarchical database consists of a collection of records that are connected to each other
through links. A record is similar to a record in the network model. Each record is a collection of
fields (attributes), each of which contains only one data value. A link is an association between
precisely two records. Thus, a link here is similar to a link in the network model
NETWORK MODEL
Network model is a scheme of database management in an organisation that allows the flow of
information or data from one user to another. The network data models are normally used for
representing a complex data relationship effectively to users, improving the performance of
database, and creating a database standard. The Network Model replaces the hierarchical tree
with graph thus allowing more general connection with the nodes
Advantages and Disadvantages of Network Model
The Network model retains almost all the advantages of the hierarchical model while eliminating
some of its shortcomings.
The main advantages of the network model are
Conceptual simplicity: Just like the hierarchical model, the network model IS also conceptually
simple and easy to design.
Capability to handle more relationship types: The network model can handle the one to- many
(l:N) and many to many (N:N) relationships, which is a real help in modeling the real life
situations.
Ease of data access: The data access is easier and flexible than the hierarchical model.
Data Integrity: The network model does not allow a member to exist without an owner. Thus, a
user must first define the owner record and then the member record. This ensures the data
integrity.
Data independence: The network model is better than the hierarchical model in isolating the
programs from the complex physical storage details.
Database Standards: One of the major drawbacks of the hierarchical model was the non-
availability of universal standards for database design and modeling. The network model is
based on the standards formulated by the DBTG and augmented by ANSI/SP ARC (American
National Standards Institute/Standards Planning and Requirements Committee) in the 1970s. All
the network database management systems conformed to these standards. These standards
included a Data Definition Language (DDL) and the Data Manipulation Language (DML), thus
greatly enhancing database administration and portability.
Disadvantages of Network Model
Even though the network database model was significantly better than the hierarchical database
model, it also had many drawbacks. Some of them are:
System complexity: All the records are maintained using pointers and hence the whole database
structure becomes very complex.
Operational Anomalies: As discussed earlier, network model's insertion, deletion and updating
operations of any record require large number of pointer adjustments, which makes its
implementation very complex and complicated.
Absence of structural independence: Since the data access method in the network database
model is a navigational system, making structural changes to the database is very difficult in
most cases and impossible in some cases. If changes are made to the database structure then all
the application programs need to be modified before they can access data. Thus, even though the
network database model succeeds in achieving data independence, it still fails to achieve
structural independence.
Because of the disadvantages mentioned and the implementation and administration
complexities, the relational database model replaced both the hierarchical and network database
models in the 1980s. The evolution of the relational database model is considered as one of the
greatest events-a major breakthrough in the history of database management.
OPERATIONAL DATA
1. data for the daily operations of the business
3. Data and knowledge are probably among the most important assets an organization has. Data
being stored for operational, backup or archive purposes. operational data is typically stored in:
databases- data from transaction processing or customer data files- business documents, images,
or company brochures, or disk storage
4. lack of data standards & definitions, poor quality data, not useful formats and organization
5. database for transaction processing systems that use data warehouse concepts to provide clean
data, cheaper
6. typically stored in: databases—data from transaction processing systems or customer data;
files—business documents, images, or company brochures; or
8. Type of data includes such information as the number of aircraft on the mission, lost,
damaged, or aborted?
9. data that specifies as possible every operation, procedure, and instrument needed to measure a
construct
11. is sometimes too large to be queried and may bring whole system down
12. Mostly stored in relational database. optimized to support transactions representing daily
operations (crud)
15. lack of data standards & definitions, poor quality data, not useful formats and organization
16. informatics
17. data used for operational needs, data that is used to help a function/operation follow
through, produced through queries
DATA INDEPENDENCE
The ability to modify a schema definition in one level without affecting a schema definition in
the next higher level is called as ‘Data Independence’
There are 2 levels of Data Independence:
Physical Data Independence :
Protection from changes in physical structure of data
Logical Data Independence :
Protection from changes in logical structure of data.
Physical Level
The Lowest level of abstraction describes “how” the data are actually stored. At the Physical
level, complex low level data structures are described in detail.
Logical Level
The next higher level of abstraction. It describes what data are stored in the database and what
relationships exists among the data.
The entire database is expressed in terms of small number of simple structures.
Although implementation of simple structure at the logical level involves complex physical level
structure, the user of logical level does not need to be aware of this complexity. The logical
level of abstraction, used by the DBA, who must decide what information is to be kept in the
database.
View Level
Highest level of abstraction.
Describes only part of the entire database.
Some complexity occurs. Many users of the database system will not be concerned with all this
information.Instead, such users need to access only part of a database so that their interaction
with the system is simplified; the view level of abstraction is defined.
The system provides many views for the same database.The 3 levels of data abstraction can be
diagrammatically represented as:
The concept of ‘datatypes’ in programming languages’ – used to provide a distinction among the
various levels of abstraction.
E.g. consider a pascal ‘record’ data type (Similar to Structure data type of C)
type customer = record
customer_name : string;
customer_street: string;
customer_city : string;
end;
Example: University Database
Conceptual schema
Students(sid: string, name: string, login: string, age: integer, gpa:real)
Courses(cid: string, cname:string, credits:integer)
Enrolled(sid:string, cid:string, grade:string)
Physical schema
Relations stored as unordered files.
Index on first column of Students.
External Schema (View):
Course_info(cid:string,enrollment:integer)
ARCHITECTURE FOR A DATABASE SYSTEM
A Database system is partitioned into modules that deal with each of the responsibilities of the
overall system. The design of a database system must include consideration of the interface
between the database system and the operating system. The functional components of a database
system is broadly divided into:
QUERY PREPROCESSOR
DML compiler
Translates the DML statements in a query language into low level instructions that a query
evaluation engine can understand. The DML compiler attempts to transform a user’s request in
an efficient form.
Embedded DML Precompiler
Converts DML statements embedded in an application program to normal procedure calls in the
host language. The precompiler must interact with the DML compiler to generate appropriate
code.
DDL Interpreter
Interprets DDL statements and records them in set of tables containing metadata.
Query Evaluation Engine
Executes low level instructions generated by the DML compiler.
STORAGE MANAGER COMPONENTS INCLUDE:
1. Authorisation and Integrity manager
2. Transaction Manager
3. File Manager
4. Buffer Manager.
Authorisation and Integrity Manager
Tests for the satisfaction of integrity constraints and checks the authority of users to access the
data.
Transaction Manager
Which ensures that the database remains in a consistent (correct) state despite system failures
and that concurrent transaction executions proceed without conflicting.
File Manager
Manages the allocation of space on the disk storage and the data structures used to represent the
information stored on disk.
Buffer Manager:
Responsible for fetching data from the disk storage into main memory and deciding what data to
cache in memory.
Database System Environment
DBMS Components
Stored Data Manager
The database and the database catalogue are stored on disk
Access to the disk is handled by the Operating System.
A higher-level stored data manager controls access to DBMS information that is stored on
disk, whether part of the database or the catalogue.
The stored data manager may use basic OS services for carrying out low-level data transfer,
such as handling buffers.
Once data is in buffers, the other DBMS modules, as well as other application programs can
process it.
DDL Compiler
Processes the schema definitions and stores the descriptions (meta-data) in the catalogue.
Runtime Database Processor
Handles database access at runtime.
Received retrieval or update operations and carries them out on the database.
Access to the disk goes through the stored data manager.
Query Compiler
Handles high-level queries entered interactively.
Parses, analyzes and interprets a query, then generates calls to the runtime processor for
execution.
Precompiler
Extracts DML commands from an application program written in a host language.
Commands are sent to DML compiler for compilation into code for database access. The rest is
sent to the host language compiler.
Client Program
Accesses the DBMS running on a separate computer from the computer on which the database
resides. It is called the client computer, and the other is the database server. In some cases a
middle level is called the application server.
A key objective for a distributed system is that it looks like a centralized system to the user. The
user should not need to know where a piece of data is stored physically.
A database user accesses the distributed database through:
Local applications
applications which do not require data from other sites.
Global applications
applications which do require data from other sites.
A homogeneous distributed database has identical software and hardware running all databases
instances, and may appear through a single interface as if it were a single database.
A heterogeneous distributed database may have different hardware, operating systems, database
management systems, and even data models for different databases.
Replicated Data
Replicated data means that copies of the same data are maintained in more than one location.
Data may be replicated across multiple machines to avoid transmitting data between systems.
Replicas can be read only or writable. Read only replicas have changes made to the original
and then propagated outwards to the replicas. Writable replicas propagate changes back to the
original using either a "write through" or a "write back" strategy.
Replicated data is most effective when data is not updated frequently. This tool suite
maintains replicated databases for each installation.
Reorganized Data
Reorganized data is data that has been derived, summarized, or otherwise manipulated in
some way. This type of data organization is common where decision-support processing is
performed.
There may be some instances where the on-line transaction processing (OLTP) and decision-
support database management systems are different. Decision-support typically requires better
query optimization and ad hoc SQL support than does OLTP. OLTP usually requires
optimization for high-volume transaction processing.
Separate-Schema Data
Separate-schema data maintains separate databases and application programs for different
systems. For example, one system may manage inventory and one may handle customer orders.
There may be a certain amount of duplication with separate-schema data.
EXAMPLE
Hard Disk
Data representation is generally how information is conceived, manipulated, and recorded. The
term can also be defined as the form in which data and information is kept in a certain
environment. How data is stored varies from one environment to another, with each environment
having its own set of rules and standards.
Data is raw, unprocessed information. In and of itself it may not mean much.
Information, on the other hand, is processed data that has meaning.
Examples:
Data: A person's age, a person's gender, or the color of a car. Individually, it means not much.
Information: If a program takes the above data and processes it, now the results take meaning.
Example: A 25 year old man likes to drive a red car.
Introduction
Data Structure Diagram (DSD) is the diagram of a conceptual data model which documents
the entities and their relationships, as well as the constraints that binds them.
The basic graphic notation elements of DSDs are boxes, representing entities, and arrows,
representing relationships. Data structure diagrams are most useful for documenting complex
data entities.
Overview
Data Structure Diagram is a diagram type that is used to depict the structure of data elements in
the data dictionary. The data structure diagram is a graphical alternative to the composition
specifications within such data dictionary entries.
The data structure diagram is a predecessor of the entity-relationship model (E-R model). In
DSDs, attributes are specified inside the entity boxes rather than outside of them, while
relationships are drawn as boxes composed of attributes which specify the constraints that bind
entities together. DSDs differ from the E-R model in that the E-R model focuses on the
relationships between different entities, whereas DSDs focus on the relationships of the elements
within an entity.
There are several styles for representing data structure diagrams, with the notable difference in
the manner of defining cardinality. The choices are between arrow heads, inverted arrow heads
(crow's feet), or numerical representation of the cardinality.
Corresponding Operators
Transvering.
Searching.
Inserting.
Deleting.
Sorting.
Merging.
Transvering
Accessing each record exactly once so that certain items in the record may be processed. (This
accessing / processing are sometimes called “Visiting” the records)
Searching
Finding the location of record with a given key value or finding the locations of all records
which satisfy one or more datas.
Inserting
Deleting
Sorting
Merging
Combining the records in two sorted files into a single sorted file.
RELATIONAL APPROACH
The relational model for database management is a database model based on first-order
predicate logic, first formulated and proposed in 1969 by Edgar F. Codd. In the relational model
of a database, all data is represented in terms of tuples, grouped into relations. A database
organized in terms of the relational model is a relational database.
An Entity is an object that exists and is distinguishable from other objects. An entity may
be concrete (a person or a book, for example) or abstract (like a holiday or a concept).
An entity set is a set of entities of the same type (e.g., all persons having an account at a bank).
Entity sets need not be disjoint. For example, the entity set employee (all employees of a bank)
and the entity set customer (all customers of the bank) may have members in common.
The purpose of the relational model is to provide a declarative method for specifying data and
queries: users directly state what information the database contains and what information they
want from it, and let the database management system software take care of describing data
structures for storing the data and retrieval procedures for answering queries.
Most implementations of the relational model use the SQL data definition and query language. A
table in an SQL database schema corresponds to a predicate variable; the contents of a table to a
relation; key constraints, other constraints, and SQL queries correspond to predicates. However,
SQL databases, including DB2, deviate from the relational model in many details; Codd fiercely
argued against deviations that compromise the original principles.
A graphical representation of the entities and the relationships between them.Entity relationship
diagrams are a useful medium to achieve a common understanding of data among users and
application developers. In data modeling, an entity-relationship model (ERM) is a
representation of structured data; entity-relationship modeling is the process of generating these
models. The end-product of the modeling process is an entity-relationship diagram (ERD), a type
of Conceptual Data Model or Semantic Data Model.
3 Operations:
Insert
Delete
Update
HIERARCHICAL APPROACH
A hierarchical database model is a data model in which the data is organized into a tree-like
structure. The structure allows representing information using parent/child relationships: each
parent can have many children, but each child has only one parent (also known as a
1-to-many relationship). All attributes of a specific record are listed under an entity type.
The data is sorted hierarchically, using a downward tree. This model uses pointers to navigate
between stored data. It was the first DBMS model.
In a database an entity type is the equivalent of a table. Each individual record is represented as a
row, and each attribute as a column. Entity types are related to each other using 1: N mappings,
also known as one-to-many relationships. This model is recognized as the first database model
created by IBM in the 1960s.
Mother–child relationship: Child may only have one mother but a mother can have multiple
children. Mothers and children are tied together by links called "pointers". A mother will have a
list of pointers to each of her children.
The Hierarchical Data Model is a way of organizing a database with multiple one to many
relationships. The structure is based on the rule that one parent can have many children but
children are allowed only one parent. This structure allows information to be repeated through
the parent child relationsreated by IBM and was implemented mainly in their Information
Management System. (IMF)
The database keeps track of the different record types, their attributes, and the hierarchical
relationships between them.The attribute which assigns records to levels in the database structure
is called the key .
Features
a set of record "types"
e.g. supplier record type, department record type, part record type
a set of links connecting all record types in one data structure diagram (tree)
at most one link between two record types, hence links need not be named
for every record, there is only one parent record at the next level up in the tree
e.g. every county has exactly one state, every part has exactly one department
cannot go between records at the same level unless they share the same paren
3 Operations:
data access is easy via the key attribute, but difficult for other attributes
in the business case, easy to find record given its type (department, part or supplier)
in the geographical case, easy to find record given its geographical level (state, county, city,
census tract), but difficult to find it given any other attribute
e.g. find the records with population 5,000 or less
cannot define new linkages between records once the tree is established
NETWORK APPROACH
The network model is a database model conceived as a flexible way of representing
objects and their relationships. Its distinguishing feature is that the schema, viewed as a graph in
which object types are nodes and relationship types are arcs, is not restricted to being a hierarchy
or lattice. A set consists of an owner record type, a set name, and a member record type. A
member record type can have that role in more than one set, hence the multiparent concept is
supported. An owner record type can also be a member or owner in another set.
3 Operations:
Insert - There will be no connector records for the new place because its like an chain
Delete – Entire link (chains) will be deleted. Two chains will be adjusted appropriately (such
adjustments may happen automatically).
The DBMS mainly provides two database languages, namely, data definition language and data
manipulation language to implement the databases. Data definition language (DDL) is used for
defining the database schema. The DBMS comprises DDL compiler that identifies and stores the
schema description in the DBMS catalog. Data manipulation language (DML) is used to
manipulate the database.
DDL – the data definition language, used by the DBA and database designers to define the
conceptual and internal schemas.
The DBMS has a DDL compiler to process DDL statements in order to identify the schema
constructs, and to store the description in the catalogue.
In databases where there is a separation between the conceptual and internal schemas, DDL is
used to specify the conceptual schema, and SDL, storage definition language, is used to specify
the internal schema.
Once the schemas are compiled, and the database is populated with data, users need to
manipulate the database. Manipulations include retrieval, insertion, deletion and modification.
The DBMS provides operations using the DML, data manipulation language.
In most DBMSs, the VDL, DML and the DML are not considered separate languages, but a
comprehensive integrated language for conceptual schema definition, view definition and data
manipulation. Storage definition is kept separate to fine-tune the performance, usually done by
the DBA staff.
An example of a comprehensive language: SQL, which represents a VDL, DDL, DML as well as
statements for constraint specification, etc.
In DBMSs where no strict separation between the levels of the database is maintained, the data
definition language is used to define the conceptual and internal schemas for the database. On
the other hand, in DBMSs, where a clear separation is maintained between the conceptual and
internal levels, the DDL is used to specify the conceptual schema only. In such DBMSs, a
separate language, namely, storage definition language (SDL) is used to define the internal
schema. Some of the DBMSs that are based on true three-schema architecture use a third
language, namely, view definition language (VDL) to define the external schema.
The DDL statements are also used to specify the integrity rules (constraints) in order to maintain
the integrity of the database. The various integrity constraints are domain constraints, referential
integrity, assertions and authorization. These constraints are discussed in detail in subsequent
chapters. Like any other programming language, DDL also accepts input in the form of
instructions (statements) and generates the description of schema as output. The output is placed
in the data dictionary, which is a special type of table containing metadata. The DBMS refers the
data dictionary before reading or modifying the data. Note that the database users cannot update
the data dictionary; instead it is only modified by database system itself.
Once the database schemas are defined and the initial data is loaded into the database, several
operations such as retrieval, insertion, deletion, and modification can be applied to the database.
The DBMS provides data manipulation language (DML) that enables users to retrieve and
manipulate the data. The statement which is used to retrieve the information is called a query.
The part of the DML used to retrieve the information is called a query language. However, query
language and DML are used synonymously though technically incorrect. The DML are of two
types, namely, non-procedural DML and procedural DML.
The procedural or low-level DML requires user to specify what data is required and how to
access that data by providing step-by-step procedure. For example, relational algebra is
procedural query language, which consists of set of operations such as select, project, union, etc.,
to manipulate the data in the database. It Must be embedded in a general purpose programming
language.Typically retrieves individual records or objects from the database and processes each
separately.Therefore it needs to use programming language constructs such as loops.
Low-level DMLs are also called record at a time DMLS because of this.High-level DMLs, such
as SQL can specify and retrieve many records in a single DML statement, and are called set at a
time or set oriented DMLs.High-level languages are often called declarative, because the DML
often specifies what to retrieve, rather than how to retrieve it.
DDL
Data Definition Language (DDL) statements are used to define the database structure or schema.
Some examples:
CREATE - to create objects in the database
TRUNCATE - remove all records from a table, including all spaces allocated for the records
are removed
DML
Data Manipulation Language (DML) statements are used for managing data within schema
objects. When DML commands are embedded in a general purpose programming language, the
programming language is called the host language and the DML is called the data sub-language.
Casual end users use high-level query language to specify requests, where programmers usually
use embedded DML.Parametric end users usually interact with user-friendly interfaces, which
can also be used by casual users who don’t want to learn the high-level languages.
Some examples:
DELETE - deletes all records from a table, the space for the records remain
A database administrator (short form DBA) is a person responsible for the installation,
configuration, upgrade, administration, monitoring and maintenance of databases in an
organization.The role includes the development and design of database strategies, system
monitoring and improving database performance and capacity, and planning for future expansion
requirements. They may also plan, co-ordinate and implement security measures to safeguard the
database.
RESPONSIBILITIES OF DBA
DBA is the overall commander of a computer system, so it has number of duties, but some
of his/her major responsibilities are as follows:
1. DBA can control the data, hardware, and software and gives the instructions to the
application programmer, end user and naive user.
2. DBA decides the information contents of the database. He decides the suitable database file
structure for arrangement of data. He/She uses the proper DDL techniques.
4. DBA decides where data can be stored i.e. take decision about the storage structure.
5. DBA decides which access strategy and technique should be used for accessing the data.
6. DBA communicates with the user by appropriate meeting, DBA co-operates with
7. user.
8. DBA also define and, apply authorized checks and validation procedures.
9. DBA also takes backup of the data on a backup storage device so that if data can be lost then
it can be again recovered and compiled. DBA also recovers the damaged data.
10. DBA also changes the environment according to user or industry requirement and monitor
the performance.
11. DBA should be good decision-maker. The decision taken by DBA should be correct, accurate
& efficient.
13. DBA liaise with the user in the business to take confidence of the customer about availability
of data.
Database User
(a) Naïve user
Naïve user has no knowledge of database system and its any supporting software. These are
used at the end form. These are like a layman, which have little bit knowledge or computer
system. These users are mainly used for collecting the data on the notebooks or on the pre-
deigned forms. An automated teller machine (ATMs) user are in these categories. Naïve user can
work on any simple GUI base menu driven system. Internet using non-computer based person
are in this form.
CERTIFICATION
Employing organizations may require that a database administrator have a certification for the
particular RDBMS being used.
Skills
List of skills required to become database administrators are:
Communication skills
Knowledge of database theory
Knowledge of database design
Knowledge about the RDBMS itself, e.g. Oracle Database, IBM DB2, Microsoft SQL Server,
MaxDB
Knowledge of Structured Query Language (SQL) and procedural extension language, e.g.
PL/SQL, SQL/PSM, Transact-SQL
General understanding of distributed computing architectures, e.g. Client/Server,
Internet/Intranet, Enterprise
General understanding of the underlying operating system, e.g. Windows, Unix, Linux
General understanding of storage technologies, memory management, disk arrays.
Duties
A database administrator's responsibilities can include the following tasks:
Installing and upgrading the database server and application tools
Allocating system storage and planning future storage requirements for the database system
Modifying the database structure, as necessary, from information given by application
developers
Enrolling users and maintaining system security
Ensuring compliance with database vendor license agreement
Controlling and monitoring user access to the database
Monitoring and optimizing the performance of the database
Planning for backup and recovery of database information
Maintaining archived data
Backing up and restoring databases
Contacting database vendor for technical support
Game server hosting, administration of games, using a database.
Job titles
DBAs are also known by the titles Database Coordinator or Database Programmer, although a
database programmer requires more advanced skills in SQL programming than a DBA may
have, and a Database Programmer may not have and does not require the skills of database
administration, backing up, restoring, monitoring or tuning to do their job well.The role is
closely related to the other jobs of Database Analyst, Database Modeller, Programmer Analyst,
and Systems Manager.
Some organizations have a hierarchical level of database administrators, generally:
Data Analysts/Query designers
Junior DBAs
Midlevel DBAs
Senior DBAs
DBA consultants
Manager/Director of Database Administration/Information Technology
GENERAL DISCUSSION
Back-end database
A back-end database is a database that is accessed by users indirectly through an external
application rather than by application programming stored within the database itself or by low
level manipulation of the data (e.g. through SQL commands).
A back-end database stores data but does not include end-user application elements such as
stored queries, forms, macros or reports. Front-end and back-end are terms used to characterize
program interfaces and services relative to the initial user of these interfaces and services. (The
"user" may be a human being or a program.) A "front-end" application is one that application
users interact with directly. A "back-end" application or program serves indirectly in support of
the front-end services, usually by being closer to the required resource or having the capability to
communicate with the required resource. The back-end application may interact directly with the
front-end or, perhaps more typically, is a program called from an intermediate program that
mediates front-end and back-end activities.
Back end systems are corporate systems that are used to run a company such as systems to
manage orders, inventory and supply processing. Back end systems support the company's back
office. This system collects input from users or other systems for processing.
Oracle
STORAGE
The Oracle RDBMS stores data logically in the form of tablespaces and physically in the form of
data files ("datafiles").[6] Tablespaces can contain various types of memory segments, such as
Data Segments, Index Segments, etc. Segments in turn comprise one or more extents. Extents
comprise groups of contiguous data blocks. Data blocks form the basic units of data storage.
A DBA can impose maximum quotas on storage per user within each tablespace
Partitioning
Newer versions of the database can also include a partitioning feature: this allows the
partitioning of tables based on different set of keys. Specific partitions can then be easily added
or dropped to help manage large data sets.
Monitoring
Oracle database management tracks its computer data storage with the help of information stored
in the SYSTEM tablespace. The SYSTEM tablespace contains the data dictionary—and often
(by default) indexes and clusters. A data dictionary consists of a special collection of tablesthat
contains information about all user-objects in the database. Since version 8i, the Oracle RDBMS
also supports "locally managed" tablespaces which can store space management information in
bitmaps in their own headers rather than in the SYSTEM tablespace (as happens with the default
"dictionary-managed" tablespaces). Version 10g and later introduced the SYSAUXtablespace
which contains some of the tables formerly stored in the SYSTEM tablespace, along with
objects for other tools such as OEM which previously required its own tablespace
Disk files
Disk files primarily represent one of the following structures:
Data and index files: These files provide the physical storage of data, which can consist of the
data-dictionary data (associated to the tablespace SYSTEM), user data, or index data. These files
can be managed manually or managed by Oracle itself ("Oracle-managed files"). Note that a
datafile has to belong to exactly one tablespace, whereas a tablespace can consist of multiple
datafiles.
Redo log files, consisting of all changes to the database, used to recover from an instance
failure. Note that often a database will store these files multiple times, for extra security in case
of disk failure. The identical redo log files are said to belong to the same group.
Undo files: These special datafiles, which can only contain undo information, aid in recovery,
rollbacks, and read-consistency.
Archive log files: These files, copies of the redo log files, are usually stored at different
locations. They are necessary (for example) when applying changes to a standby database, or
when performing recovery after a media failure. It is possible to archive to multiple locations.
Tempfiles: These special datafiles serve exclusively for temporary storage data (used for
example for large sorts or for global temporary tables)
Control file, necessary for database startup. "A binary file that records the physical structure of a
database and contains the names and locations of redo log files, the time stamp of the database
creation, the current log sequence number, checkpoint information, and so on."[9]
At the physical level, data files comprise one or more data blocks, where the block size can vary
between data files.
Data files can occupy pre-allocated space in the file system of a computer server, utilize raw disk
directly, or exist within ASM logical volumes
ORACLE ERP
Problems with Non-ERP Systems
In-house design limits connectivity outside the company
Tendency toward separate IS’s within firm
lack of integration limits communication within the company
Strategic decision-making not supported
Long-term maintenance costs high
Limits ability to engage in process reengineering
ERP
Smooth and seamless flow of information across organizational boundaries. Standardized
environment with shared database independent of applications and integrated applications.
ERP Applications
Core applications
Evolution of ERP
The employee will be assigned to perform complex technical duties involving the analysis,
design, implementation and maintenance of the following Oracle E-business suite applications
including but not limited to: Oracle Financials, Oracle Human Resource Management (HRMS),
Oracle Hyperion Budgeting, and Oracle Procurement. The employee provides development
and/or customization support across the organization for the aforementioned modules. Performs
detailed analysis and evaluation, and makes recommendations to resolve simple to complex
business problems with the appropriate technology. This job is not of a routine clerical or
ministerial nature and requires the exercise of independent judgment. An employee in this
classification may be responsible for directing the activities of subordinates. Reports to the
Manager of Enterprise Resource Planning or designee.
Essential Functions
Performs the analysis, development, modification, and maintenance of one or more of the
following Oracle applications: Oracle Financials, Oracle Human Resources Management
(HRMS), Oracle Hyperion Budgeting, and Oracle Procurement.
Meets with department managers, technical and functional resources, and users to help define
business and application requirements and resolve technical questions. Creates and maintains
custom code, custom menus, custom forms, and custom reports based on functional
specifications.
May be responsible for providing technical direction and coordinating the activities of
subordinates participating in the maintenance of Oracle E-Business applications;
Provides guidance on the capabilities of the city’s Oracle E-Business applications and their
application in order to ensure compliance with collective bargaining agreements and the City’s
policies and procedures;
Plans and implements solutions to system issues by identifying needs, researching solutions,
creating implementation plans, evaluating alternatives, executing applications, and completing
testing. Prepares, submits and tracks Oracle service requests.
Opens, monitors and tracks progress of Oracle service requests through the use of Metalink.
Performs analysis, design and development of Oracle applications utilizing the following tools:
PL/SQL, BI Publisher, Oracle Reports, Oracle Forms, Oracle Discoverer, Oracle FastFormulas,
Toad, and other suitable tools.
Syntax
Language elements
The SQL language is subdivided into several language elements, including:
Clauses, which are constituent components of statements and queries. (In some cases,
these are optional.)[16]
Expressions, which can produce either scalar values, or tables consisting
of columns androws of data.
Predicates, which specify conditions that can be evaluated to SQL three-valued logic
(3VL)(true/false/unknown) or Boolean truth values and which are used to limit the effects
of statements and queries, or to change program flow.
Queries, which retrieve the data based on specific criteria. This is an important element
ofSQL.
Statements, which may have a persistent effect on schemata and data, or which may
controltransactions, program flow, connections, sessions, or diagnostics.
SQL statements also include the semicolon (";") statement terminator. Though not
required on every platform, it is defined as a standard part of the SQL grammar.
Insignificant whitespace is generally ignored in SQL statements and queries, making it
easier to format SQL code for readability.
Queries
The most common operation in SQL is the query, which is performed with the
declarative SELECTstatement. SELECT retrieves data from one or more tables, or expressions.
Standard SELECTstatements have no persistent effects on the database. Some non-standard
implementations ofSELECT can have persistent effects, such as the SELECT INTO syntax that
exists in some databases.[18]
Queries allow the user to describe desired data, leaving the database management system
(DBMS) responsible for planning, optimizing, and performing the physical operations necessary
to produce that result as it chooses.
A query includes a list of columns to be included in the final result immediately following
theSELECT keyword. An asterisk ("*") can also be used to specify that the query should return
all columns of the queried tables. SELECT is the most complex statement in SQL, with optional
keywords and clauses that include:
The FROM clause which indicates the table(s) from which data is to be retrieved.
The FROMclause can include optional JOIN subclauses to specify the rules for joining
tables.
The WHERE clause includes a comparison predicate, which restricts the rows returned by
the query. The WHERE clause eliminates all rows from the result set for which the
comparison predicate does not evaluate to True.
The GROUP BY clause is used to project rows having common values into a smaller set of
rows. GROUP BY is often used in conjunction with SQL aggregation functions or to
eliminate duplicate rows from a result set. The WHERE clause is applied before
the GROUP BY clause.
The HAVING clause includes a predicate used to filter rows resulting from the GROUP
BYclause. Because it acts on the results of the GROUP BY clause, aggregation functions
can be used in the HAVING clause predicate.
The ORDER BY clause identifies which columns are used to sort the resulting data, and in
which direction they should be sorted (options are ascending or descending). Without
anORDER BY clause, the order of rows returned by an SQL query is undefined.
Hints
1. What's the difference between a primary key and a unique key?
Both primary key and unique key enforces uniqueness of the column on which they are defined.
But by default primary key creates a clustered index on the column, where are unique creates a
nonclustered index by default. Another major difference is that, primary key doesn't allow
NULLs, but unique key allows one NULL only.
3. What are the authentication modes in SQL Server? How can it be changed?
Windows mode and Mixed Mode - SQL and Windows. To change authentication mode in SQL
Server click Start, Programs, Microsoft SQL Server and click SQL Enterprise Manager to run
SQL Enterprise Manager from the Microsoft SQL Server program group. Select the server then
from the Tools menu select SQL Server Configuration Properties, and choose the Security page.
11. Write an SQL Query to find employee whose Salary is equal or greater than 10000
SELECT EmpName FROM Employees WHERE Salary>=10000;
12. Write an SQL Query to find name of employee whose name Start with ‘M’
SELECT * FROM Employees WHERE EmpName like 'M%';
13. find all Employee records containing the word "Joe", regardless of whether it was stored
as JOE, Joe, or joe.
SELECT * from Employees WHERE upper(EmpName) like upper('joe%');
QUESTIONS
Section – A
Section – B
1)Define DBMS.
Section- C