CseWay

A Way For Learning

Showing posts with label dbms. Show all posts
Showing posts with label dbms. Show all posts

Cursor

1. Explain about cursors ?
A cursor is defined as a work area where SQL statement is executed.There are two types of cursors.
1.Implicit cursor
2.Explicit cursor


2. Give the attributes of the implicit cursors
The attributes of implicit cursors are:
%FOUND : true if the SQL DML statement returns a row or multiple rows to the cursor
%NOTFOUND :true if the SQL DML statement does not return a row to the cursor
%ISOPEN : to check whether cursor is open or not
%ROWCOUNT : display the number of results for a given SQL DML statement


3. Give an example how implicit cursor attributes can be used

CREATE OR REPLACE PROCEDURE  DISPLAY_FLIGHT
 AS
CURSOR DIS_FLI IS
SELECT * FROM FLIGHT WHERE SOURCE_CODE IN(SELECT CITY_CODE FROM CITY_MASTER WHERE CITY_NAME='MUMBAI');
REC_FLI DIS_FLI%ROWTYPE;
BEGIN
OPEN DIS_FLI;
LOOP
FETCH DIS_FLI INTO REC_FLI;
EXIT WHEN DIS_FLI %NOTFOUND;
DBMS_OUTPUT.PUT_LINE (REC_FLI.FID||' '||REC_FLI.FNAME||'  '||REC_FLI.SOURCE_CODE||' '||REC_FLI.DESTINATION_CODE||' '||REC_FLI.JOURNEY_HOURS);
END LOOP;
END;

Database Management System

What is data model?
Data Model describes how data is connected to each other and how the data is processed and how the data is stored in the system.

What is three schema architecture?
Three schema architecture:
1. Internal Level
2. Conceptual Level
3. External Level
1. Internal Level: It is the lowest level of data abstraction that deals with the physical representation of the database on the computer and it is also known as physical level.
2. Conceptual Level: This level describes how relationship is established amount various data entities, how data is stored in the database.
3. External Level: It deals with end user. It permits users to access data in a way that is customized according to their needs, so that the same data can be seen by different users in different ways, at the same time. 

Why would you choose a database system instead of simply storing the data in Operating system files?
In a Database system large amounts of data can be stored compared to operating system files. Any kind of data can be stored in database system, where as operating system files cannot store.
In database, we can search and retrieve the data easily compared to operating system files.
Data is more secure and has less redundancy in database system when compared to operating system files.

What are the different types of languages supported in database?
There are two different types of languages supported in database. They are
1.DDL : Data Definition Language/ Data Description Language
2.DML :  Data Manipulation Language
DDL defines the database schema. It is used to build and modify the structures of databases.
DML is used by the end users to store, retrieve or manipulate the data in the databases.

What are the key stages in object oriented relational database design?
The 6 stages in object oriented relational database design are:
1.      Finding the objects
2.      Make the links
3.      Make all links one to many
4.      Add the primary keys
5.      Add the foreign keys
6.      Add the fields

What is linking in database?
Linking in database : Establishing connection between different entities in the database.

What is primary Key?
Primary Key:  The piece of information the database uses to find a record
What is foreign Key?
Foreign Key:  The piece of information the database uses to link records in different tables


Who are the different types of users accessing the database and in what way?
The different types of users accessing the database are:
1. Application Programmers
2. Sophisticated users
3. Specialised users
4. End Users
1. Application Programmers: the person who builds the database is called an application programmer
2. Sophisticated users : Sophisticated users interact with the system and  form their query language 
3. Specialised users: The Specialised users write applications database applications that do not fit into the traditional data processing framework.
4. End Users :  invoke one of the permanent application programs that have been written previously. They use the application to get their task done

What is a database? What is DBMS?
A database is a collection of relational data.

DBMS is a set of computer programs that controls the creation, maintenance and the use of a database.

What is an entity?
An entity is any real thing that can be distinguished.

Explain weak entity?

A weak entity cannot be independent. It depends on other entities

Define the following terms: relation schema, relational database schema,
domain, attribute, attribute domain, relation instance, relation cardinality, and relation
degree.
Relation schema : A relation schema is a list of attribute names.
Relational Database schema : A relational database schema is the tables, columns and relationships that make up a relational database. 
A relational database schema helps you to organize and understand the structure of a database.
Domain : Domain refers to all the values which a data element may contain.
Attributes : Attributes are the set of values that define an entity
Attribute domain ; It is the set of data values allowed in an attribute.
Relation instance: A finite set of tuples in the relational database system represents relation instance. Relation instances do not have duplicate tuples.
Relation Cardinality: It specifies the number of each entity that is involved in the relationship

Relation Degree : Number of entities participating in the relationship



Advantages of DBMS over file processing system

Advantages of DBMS over file system

DIFFERENCE BETWEEN PHYSICAL AND LOGICAL DATA INDEPENDENCE

DIFFERENCE BETWEEN PHYSICAL AND LOGICAL DATA INDEPENDENCE