BCS403 DBMS Lab Manual
BCS403 DBMS Lab Manual
RV Educational Institutions®
RV Institute of Technology and
Management
(Affiliated to VTU, Belagavi)
Lab Manual
Sl Particulars
No
1 SYLLABUS
2 INTRODUCTION TO DATABASE
3 BASIC QUERIES IN SQL
4 PRACTISE EXERCISES
5 EXPERITMENT 1 – Create user and Grant DB permissions
6 EXPERITMENT 2 – Employee Table and Basic DML operations
7 EXPERITMENT 3 - Employee Table and Aggregate operations
8 EXPERITMENT 4 – Customer Table and Create row level Trigger
9 EXPERITMENT 5 - Create cursor for Employee table
10 EXPERITMENT 6 - PL/SQL code using parameterized Cursor
11 EXPERITMENT 7 - Install an MangoDB and Create CRUD operation
12 VIVA QUESTIONS
Laboratory Outcome
▪ Define the basics of Databases, Relational model, Relational Algebra and explore the
needs and concepts of SQL queries, Normalization rules, transaction processing and
NoSQL concepts.
▪ Demonstrate and describe database objects, enforce integrity constraints, implement
the transaction processing on a database and NoSQL databases.
▪ Apply the knowledge of DBMS architecture, Relational algebra, Database design concepts,
transaction processing techniques and NoSQL concepts to design and build simple database
applications.
▪ Develop applications using relational data model concepts or NoSQL.
CIE for the theory component of the IPCC (maximum marks 50)
● IPCC means practical portion integrated with the theory of the course.
● CIE marks for the theory component are 25 marks and that for the practical component is
25 marks.
● 25 marks for the theory component are split into 15 marks for two Internal Assessment
Tests (Two Tests, each of 15
Marks with 01-hour duration, are to be conducted) and 10 marks for other assessment
methods mentioned in
22OB4.2. The first test at the end of 40-50% coverage of the syllabus and the second test
after covering 85-90% of
the syllabus.
● Scaled-down marks of the sum of two tests and other assessment methods will be CIE
marks for the theory
● The student has to secure 40% of 25 marks to qualify in the CIE of the theory component
of IPCC.
● 15 marks for the conduction of the experiment and preparation of laboratory record, and
10 marks for the test to be
● The CIE marks awarded in the case of the Practical component shall be based on the
continuous evaluation of the
laboratory report. Each experiment report can be evaluated for 10 marks. Marks of all
experiments’ write-ups are
● The laboratory test (duration 02/03 hours) after completion of all the experiments shall
be conducted for 50 marks
● Scaled-down marks of write-up evaluations and tests added will be CIE marks for the
laboratory component of IPCC
for 25 marks.
● The student has to secure 40% of 25 marks to qualify in the CIE of the practical
component of the IPCC.
Theory SEE will be conducted by University as per the scheduled timetable, with common
question papers for the course
(duration 03 hours)
1. The question paper will have ten questions. Each question is set for 20 marks.
2. There will be 2 questions from each module. Each of the two questions under a module
(with a maximum of 3 subquestions),
3. The students have to answer 5 full questions, selecting one full question from each
module.
The theory portion of the IPCC shall be for both CIE and SEE, whereas the practical
portion will have a CIE
component only. Questions mentioned in the SEE paper may include questions from the
practical component.
INTRODUCTION TO DATABASE
What is Database?
A database is a separate application that stores a collection of data. Each database has one or
more distinct APIs for creating, accessing, managing, searching, and replicating the data it
holds. now a days we use relational database management systems (RDBMS) to store and
manager huge volume of data.
RDBMS Terminology:
Table: A table is a matrix with data. A table in a database looks like a simple spreadsheet.
Column: One column (data element) contains data of one and the same kind, for example the column
postcode. or phone numbers
Row: A row (= tuple, entry or record) is a group of related data, for example the data of one
subscription.
Primary Key: A primary key is unique. A key value can not occur twice in one table. With a key
you can find at most one row.
Foreign Key: A foreign key is the linking pin between two tables.
Compound Key: A compound key (composite key) is a key that consists of multiple columns,
because one column is not sufficiently unique.
Referential Integrity: Referential Integrity makes sure that a foreign key value always points
to an
existing row.
DDL or Data Definition Language actually consists of the SQL commands that can be used to
to create and modify the structure of database objects in a database. These database objects
include views, schemas, tables, indexes, etc.
Some examples:
• CREATE - to create objects in the database
• ALTER - alters the structure of the database
• DROP - delete objects from the database
• DML is Data Manipulation Language statements: which are used to interact with a
database by deleting, inserting, retrieving, or updating data in the database.
• Some examples:
• SELECT - retrieve data from the a database INSERT - insert data into a table
• UPDATE - updates existing data within a table
• DELETE - deletes all records from a table, the space for the records remain
• DCL is Data Control Language statements: which includes commands such as GRANT
and REVOKE which mainly deals with the rights, permissions and other controls of the
database system.
CREATE TABLE
Specifies a new base relation by giving it a name, and specifying each of its attributes and their data
types
Syntax of CREATE Command:
CREATE TABLE
ORDERS (
ORDER_ID INT (6) PRIMARY KEY,
ORDER_DATE DATE
);
[alter specification] is dependent on the type of alteration we wish to perform. alter specification is
already mentioned above
You can rename a column in MySQL using the ALTER TABLE and CHANGE commands together to
change an existing column.
For example,say the column is currently named JOB, but you decide that DESIGNATION is a more
appropriate title. The column is located on the table entitled ORDERS.
DELETING COLUMN
RENAMING A TABLE
The DROP TABLE statement is used to drop an existing table in a database DROP
TABLE TABLENAME;
Example: DROP TABLE ORDER
if we wish to simply get rid of the data but not the table itself? For this, we can use the
Example:TRUNCATE customer
CONSTRAINTS:
Primary Key:-
A primary key is used to uniquely identify each row in a table. It can either be part of
the actual record itself, or it can be an artificial field (one that has nothing to do with the
actual record).
A primary key can consist of one or more fields on a table. When multiple fields are
used as a primary key, they are called a composite key.
Primary keys can be specified either when the table is created (using CREATE
TABLE) or by changing the existing table structure (using ALTER TABLE).
Below are examples for specifying a primary key when creating a table:
Example :
CREATE TABLE ORDERS (ORDER_ID INT (6) PRIMARY KEY, ORDER_DATE DATE);
Below are examples for specifying a primary key by altering a table: CREATE TABLE ORDERS
(ORDER_ID INT (6), ORDER_DATE DATE);
Note: - Before using the ALTER TABLE command to add a primary key, you'll need to make
sure that the field is defined as 'NOT NULL' -- in other words, NULL cannot be an accepted
value for that field.and column values must be unique
FOREIGN KEY
A foreign key is a field (or fields) that points to the primary key of another table.
The purpose of the foreign key is to ensure referential integrity of the data. In other
words, only values that are supposed to appear in the database are permitted
For example, say we have two tables, a CUSTOMER table that includes all customer
data, and an ORDERS table that includes all customer orders. The constraint here is that
all orders must be associated with a customer that is already in the CUSTOMER table.
In this case, we will place a foreign key on the ORDERS table and have it relate to the
primary key of the CUSTOMER table. This way, we can ensure that all orders in the
ORDERS table are related to a customer in the CUSTOMER table. .In other words, the
ORDERS table cannot contain information on a customer that is not in the CUSTOMER
table.
CREATE TABLE
CUSTOMER (
SID INT PRIMARY KEY,
Last_Name varchar(50),
First_Name varchar(50)
);
In the below example, the Customer_SID column in the ORDERS table is a foreign key
pointing to the SID column which is primary key in the CUSTOMER table.
Below we show examples of how to specify the foreign key when creating the ORDERS
table: CREATE TABLE ORDERS
(
Order_ID int,
Order_Date
date,
Customer_SID
int, Amount
double,
Primary Key (Order_ID),
Foreign Key (Customer_SID) references CUSTOMER(SID)
);
NOT NULL Constraint:-By default, a column can hold NULL. If you want to allow
or store NULL value in a column, you will want to place a constraint on this column
specifying that NULL is now not an allowable value.
UNIQUE Constraint:-The UNIQUE constraint ensures that all values in a column are distinct.
CHECK Constraint:-The CHECK constraint ensures that all values in a column satisfy certain
conditions. Once defined, the database will only insert a new row or update an existing row if the
new
value satisfies the CHECK constraint. The CHECK constraint is used to ensure data quality.
• Hence, an SQL relation (table) is a multi-set (sometimes called a bag) of tuples;not a set of
tuples
• SQL relations can be constrained to be sets by using the CREATE UNIQUE INDEX command,
or by using the DISTINCT option
DATA TYPES:
1. CHAR (Size): This data type is used to store character strings values of fixed length. The size in
brackets determines the number of characters the cell can hold. The maximum number of
character is 255 characters.
2. VARCHAR (Size) / VARCHAR2 (Size): This data type is used to store variable length
alphanumeric data. The maximum character can hold is 2000 character.
3. NUMBER (P, S): The NUMBER data type is used to store number (fixed or floating point).
Number of virtually any magnitude may be stored up to 38 digits of precision. Number as large
as 9.99 * 10 124. The precision (p) determines the number of places to the right of the decimal.
If scale is omitted then the default is zero. If precision is omitted, values are stored with their
original precision up to the maximum of 38 digits.
4. DATE: This data type is used to represent date and time. The standard format is DD- MM-YY as
in 17-SEP-2009. To enter dates other than the standard format, use the appropriate functions.
Date time stores date in the 24-Hours format. By default the time
in a date field is 12:00:00 am, if no time portion is specified. The default date for a date field is the
first day the current month.
5. LONG: This data type is used to store variable length character strings containing up to 2GB.
Long data can be used to store arrays of binary data in ASCII format. LONG values cannot be
indexed, and the normal character functions such as SUBSTR cannot be applied.
6. RAW: The RAW data type is used to store binary data, such as digitized picture or image. Data
loaded into columns of these data types are stored without any further conversion. RAW data
type can have a maximum length of 255 bytes. LONG RAW data type can contain up to 2GB.
• Clauses, which are in some cases optional, constituent components of statements and queries.
• Expressions, which can produce either scalar values or tables consisting of columns and rows of
data.
• Predicates which specify conditions that can be evaluated to SQL three-valued logic (3VL)
Boolean truth values and which are used to limit the effects of statements and queries, or to
change program flow.
• Queries which retrieve data based on specific criteria.
• Statements which may have a persistent effect on schemas and data, or which may control
transactions, 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 white space is generally ignored in SQL statements and queries, making it easier to
format SQL code for readability.
1. DATA DEFINITION LANGUAGE (DDL): The Data Definition Language (DDL) is used to
create and destroy databases and database objects. These commands will primarily be used by
database administrators during the setup and removal phases of a database project.
Let's take a look at the structure and usage of four basic DDL commands:
1. CREATE 2. ALTER 3. DROP 4. RENAME
1. CREATE:
(a)CREATE TABLE: This is used to create a new relation (table)
Example:
SQL> CREATE TABLE Student (sno NUMBER (3), sname CHAR (10), class CHAR (5));
2. ALTER:
(a) ALTER TABLE ...ADD...: This is used to add some extra fields into existing relation.
Syntax: ALTER TABLE relation_name ADD (new field_1 data_type(size), new field_2
data_type(size),..);
Example: SQL>ALTER TABLE std ADD (Address CHAR(10));
(b) ALTER TABLE...MODIFY...: This is used to change the width as well as data type of fields of
existing relations.
d) ALTER TABLE..RENAME...: This is used to change the name of fields in existing relations.
Syntax: ALTER TABLE relation_name RENAME COLUMN (OLD field_name) to (NEW
field_name);
Objective:
NUMBER FUNCTION:
Abs(n) :Select abs(-15) from dual; Exp(n): Select exp(4) from dual; Power(m,n): Select power(4,2)
from dual; Mod(m,n): Select mod(10,3) from dual;
Round(m,n): Select round(100.256,2) from dual; Trunc(m,n): ;Select trunc(100.256,2) from dual;
Sqrt(m,n);Select sqrt(16) from dual;
Develop aggregate plan strategies to assist with summarization of several data entries.
Aggregative operators: In addition to simply retrieving data, we often want to perform some
computation or summarization. SQL allows the use of arithmetic expressions. We now consider
a powerful class of constructs for computing aggregate values such as MIN and SUM.
1. Count: COUNT following by a column name returns the count of tuple in that column. If
DISTINCT keyword is used then it will return only the count of unique tuple in the column.
Otherwise, it will return count of all the tuples (including duplicates) count (*) indicates all the
tuples of the column.
Syntax: COUNT (Column name)
3. AVG: AVG followed by a column name returns the average value of that column values.
Syntax: AVG (n1, n2...)
Example: Select AVG (10, 15, 30) FROM DUAL;
4. MAX: MAX followed by a column name returns the maximum value of that column.
Syntax: MAX (Column name)
Example: SELECT MAX (Sal) FROM emp;
SQL> select deptno, max(sal) from emp group by deptno;
10 5000
20 3000
30 2850
SQL> select deptno, max (sal) from emp group by deptno having max(sal)<3000; DEPTNO
MAX(SAL)
30 2850
5. MIN: MIN followed by column name returns the minimum value of that column.
Syntax: MIN (Column name)
Example: SELECT MIN (Sal) FROM emp;
CHARACTER FUNCTION:
initcap(char) : select initcap(“hello”) from dual; lower (char): select lower (‘HELLO’) from dual;
upper (char) :select upper (‘hello’) from dual;
ltrim (char,[set]): select ltrim (‘cseit’, ‘cse’) from dual; rtrim (char,[set]): select rtrim (‘cseit’, ‘it’)
from dual;
replace (char,search ): select replace(‘jack and jue’,‘j’,‘bl’) from dual;
CONVERSION FUNCTIONS:
To_char: TO_CHAR (number) converts n to a value of VARCHAR2 data type, using the optional
number format fmt. The value n can be of type NUMBER, BINARY_FLOAT, or
BINARY_DOUBLE.
STRING FUNCTIONS:
Concat: CONCAT returns char1 concatenated with char2. Both char1 and char2 can be any of the
datatypes.
SQL>SELECT CONCAT(‘ORACLE’,’CORPORATION’)FROM DUAL;
ORACLECORPORATION
Lpad: LPAD returns expr1, left-padded to length n characters with the sequence of
characters in expr2.
SQL>SELECT LPAD(‘ORACLE’,15,’*’)FROM DUAL;
*********ORACLE
Rpad: RPAD returns expr1, right-padded to length n characters with expr2, replicated asmany
times as necessary.
SQL>SELECT RPAD (‘ORACLE’,15,’*’)FROM DUAL;
ORACLE*********
Upper: Returns a character expression with lowercase character data converted to uppercase
SQL>SELECT UPPER(‘dbms’)FROM DUAL;
DBMS
Length: Returns the number of characters, rather than the number of bytes, of the givenstring
expression, excluding trailing blanks.
SQL>SELECT LENGTH(‘DATABASE’)FROM DUAL;8
Instr: The INSTR functions search string for substring. The function returns an integer
indicating the position of the character in string that is the first character of this occurrence.SQL>SELECT
INSTR('CORPORATE FLOOR','OR',3,2)FROM DUAL;
14
DATE FUNCTIONS:
Sysdate:
SQL>SELECT SYSDATE FROMDUAL;
next_day:
SQL>SELECT NEXT_DAY(SYSDATE,’WED’)FROM DUAL
add_months:
SQL>SELECT ADD_MONTHS(SYSDATE,2)FROM DUAL;
last_day:
SQL>SELECT LAST_DAY(SYSDATE)FROM DUAL;
months_between:
SQL>SELECT MONTHS_BETWEEN(SYSDATE,HIREDATE)FROM EMP;
Least:
SQL>SELECT LEAST('10-JAN-07','12-OCT-07')FROM DUAL;
Greatest:
SQL>SELECT GREATEST('10-JAN-07','12-OCT-07')FROM DUAL;
_________________________________________________________________________________
Lab Programs
Create a table called Employee & execute the following.
1 Employee(EMPNO, ENAME, JOB, MANAGER_NO, SAL, COMMISSION)
1. Create a user and grant all permissions to the user.
2. Insert the any three records in the employee table contains attributes EMPNO,ENAME JOB,
MANAGER_NO, SAL, COMMISSION and use rollback. Check the result.
3. Add primary key constraint and not null constraint to the employee table.
4. Insert null values to the employee table and verify the result.
_____________________________________________________________________________________
28
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
4. SQL>Adding primary key constraint and not null constraint to the Employee table
ALTER TABLE Employee
ADD CONSTRAINT PK_Employee_EMPNO PRIMARY KEY (EMPNO),
ADD CONSTRAINT CHK_SALARY CHECK (SAL > 0),
MODIFY ENAME VARCHAR(50) NOT NULL,
MODIFY JOB VARCHAR(50) NOT NULL,
MODIFY SAL DECIMAL(10,2) NOT NULL;
2 Create a table called Employee that contain attributes EMPNO, ENAME, JOB, MGR,SAL &
execute the following.
1. Add a column commission with domain to the Employeetable.
2. Insert any five records into the table.
3. Update the column details of job
4. Rename the column of Employ table using alter command.
5. Delete the employee whose Empno is 105
_________________________________________________________________________________
);
3. SQL>UPDATE Employee
SET JOB = 'Executive'
WHERE EMPNO = 105;
_____________________________________________________________________________________
30
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
3 Queries using aggregate functions (COUNT, AVG, MIN, MAX, SUM), Group by, Orderby.
Employee(E_id, E_name, Age, Salary)
1. Create Employee table containing all Records E_id, E_name, Age, Salary.
2. Count number of employee names from employeetable
3. Find the Maximum age from employee table.
4. Find the Minimum age from employeetable.
5. Find salaries of employee in Ascending Order.
6. Find grouped salaries of employees.
_________________________________________________________________________________
Salary DECIMAL(10, 2) );
_____________________________________________________________________________________
32
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
_____________________________________________________________________________________
33
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
6. SQL> SELECT Salary, COUNT(*) AS Employee Count FROM Employee GROUP BY Salary;
4 Create a row level trigger for the customers table that would fire for INSERT or UPDATE or
DELETE operations performed on the CUSTOMERS table. This trigger will display the salary
difference between the old & new Salary. CUSTOMERS table contains the following columns (ID,
NAME, AGE, ADDRESS, SALARY)
_____________________________________________________________________________________
34
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
-- INSERT TRIGGER
DELIMITER //
DELIMITER ;
-- UPDATE TRIGGER
DELIMITER //
_____________________________________________________________________________________
35
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
DELIMITER ;
-- DELETE TRIGGER
DELIMITER //
DELIMITER ;
_____________________________________________________________________________________
36
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
+-----------------------------+
| SAL_DIFF |
+-----------------------------+
| salary inserted is 50000.00 |
+-----------------------------+
1 row in set (0.01 sec)
_____________________________________________________________________________________
37
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
5 Create cursor for Employee table & extract the values from the table. Declare the variables Open
the cursor & extract the values from the cursor. Close the cursor. Employee(E_id, E_name, Age,
Salary)
USE COMPANY05;
DELIMITER //
_____________________________________________________________________________________
38
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
DELIMITER ;
CALL fetch_employee_data();
_____________________________________________________________________________________
39
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
6 Write a PL/SQL block of code using parameterized Cursor, that will merge the data available in the
newly created table N_RollCall with the data available in the table O_RollCall. If the data in the
first table already exist in the second table then that data should be skipped.
USE ROLLCALL;
_________________________________________________________________________________
_____________________________________________________________________________________
41
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
_____________________________________________________________________________________
42
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
DELIMITER ;
_____________________________________________________________________________________
43
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
7 Install an Open Source NoSQL Data base MangoDB & perform basic CRUD(Create, Read, Update
& Delete) operations. Execute MangoDB basic Queries using CRUD operations
use bookDB
db.createCollection("ProgrammingBooks")
_____________________________________________________________________________________
44
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
db.ProgrammingBooks.insertMany([
{
title: "Clean Code: A Handbook of Agile Software Craftsmanship",
author: "Robert C. Martin",
category: "Software Development",
year: 2008
},
{
title: "JavaScript: The Good Parts",
author: "Douglas Crockford",
category: "JavaScript",
year: 2008
},
{
title: "Design Patterns: Elements of Reusable Object-Oriented Software",
author: "Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides",
category: "Software Design",
year: 1994
},
{
title: "Introduction to Algorithms",
author: "Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein",
category: "Algorithms",
year: 1990
},
{
title: "Python Crash Course: A Hands-On, Project-Based Introduction to Programming",
author: "Eric Matthes",
category: "Python",
year: 2015
}
])
_____________________________________________________________________________________
45
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
db.ProgrammingBooks.insertOne({
title: "The Pragmatic Programmer: Your Journey to Mastery",
author: "David Thomas, Andrew Hunt",
category: "Software Development",
year: 1999
})
_____________________________________________________________________________________
46
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
db.ProgrammingBooks.find().pretty()
_____________________________________________________________________________________
47
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
//delete collection
_____________________________________________________________________________________
48
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
db.ProgrammingBooks.drop()
_____________________________________________________________________________________
49
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
1. What is database?
2. What is DBMS?
1. Redundancy is controlled.
2. Unauthorised access is restricted.
3. Providing multiple user interfaces.
4. Enforcing integrity constraints.
5. Providing backup and recovery.
_____________________________________________________________________________________
50
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
1. Physical level: The lowest level of abstraction describes how data are stored.
_____________________________________________________________________________________
51
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
schema definition in one level should not affect the schema definition in the next
higher level.
Two types of Data Independence:
A view may be thought of as a virtual table, that is, a table that does not really exist
in its own right but is instead derived from one or more underlying base table. In
other words, there is no stored file that direct represents the view instead a definition
of view is stored in data dictionary.
Growth and restructuring of base tables is not reflected in views. Thus the
view can insulate users from the effects of restructuring and growth in the
database. Hence accounts for logicaldata independence.
A collection of conceptual tools for describing data, data relationships data semantics
and constraints.
This data model is based on real world that consists of basic objects called
entities and of relationship among these objects. Entities are described in a
_____________________________________________________________________________________
52
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
The collections of entities of a particular entity type are grouped together into an
entity set.
An entity set may not have sufficient attributes to form a primary key, and
its primary key compromises of its partial key and primary key of its parent
entity, then it is said to be WeakEntity set.
_____________________________________________________________________________________
53
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
_____________________________________________________________________________________
54
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
_________________________________________________________________________________
anomalies.
It guarantees that the spurious tuple generation does not occur with respect to
relation schemas after decomposition.
The domain of attribute must include only atomic (simple, indivisible) values.
_____________________________________________________________________________________
56
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
1. X is a Super-key of R.
2. A is a prime attribute of R.
1. Atomicity: Either all actions are carried out or none are. Users should
not have to worry about the effect of incomplete transactions. DBMS
_____________________________________________________________________________________
57
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
A query with respect to DBMS relates to user commands that are used to
interact with a data base. Thequery language can be classified into data
definition language and data manipulation language.
Subqueries, or nested queries, are used to bring back a set of rows to be used
by the parent query. Depending on how the subquery is written, it can be
executed once for the parent query or it can be
executed once for each row returned by the parent query. If the subquery is
executed for eachrow of the parent, this is called a correlated subquery.
41. What are the primitive operations common to all record management
systems?
_____________________________________________________________________________________
58
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
43. Are the resulting relations of PRODUCT and JOIN operation the same?
No.
PRODUCT: Concatenation of every row in one relation with every row in another.
JOIN: Concatenation of rows from one relation and related rows from another.
44. Which part of the RDBMS takes care of the data dictionary? How?
47. Define SQL and state the differences between SQL and other
_____________________________________________________________________________________
59
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
conventionalprogramming Languages.
48. Name the three major set of files on disk that compose a database in Oracle.
There are three major sets of files on disk that compose a database. All the files are
binary. These are
The most important of these are the database files where the actual data resides.
The control filesand the redo logs support the functioning of the architecture
itself. All three sets of files must be present, open, and available to Oracle for any
data on the database to be useable. Without these files, you cannot access the
database, and the database administrator might have to recover someor all of the
database using a backup, if there is one.
_________________________________________________________________________________
written in PL/SQL.
Procedures that are not part of a package are known as stand-alone because they
independently defined. These types of procedures are not available for reference
from other Oracle tools. Anotherlimitation of stand-alone procedures is that they
are compiled at run time, which slows execution.
PL/SQL uses cursors for all database information accesses statements. The
language supports theuse two types of cursors
1.) Implicit
2.) Explicit
_____________________________________________________________________________________
61
DATABASE MANAGEMENT SYSTEMS(BCS403)
RV Institute of Technology and Management®
_________________________________________________________________________________
_____________________________________________________________________________________
62
DATABASE MANAGEMENT SYSTEMS(BCS403)