Database management system
Database management system
ENROLLMENT NO:
Answer:
DBMS allows users to create their own databases as per their requirement.
The term “DBMS” includes the user of the database and other application
programs. It provides an interface between the data and the software
application.
Advantages of DBMS
Answer:
1. Centralized Databases
2. Distributed Database
3. NoSQL Database
4. Cloud Database
5. Relational Database
6. Network Database
7. Object-oriented Database
8. Hierarchical Database
1. Centralised Database
The information(data) is stored at a centralized location and the users from
different locations can access this data. This type of database contains
application procedures that help the users to access the data even from a
remote location.
Various kinds of authentication procedures are applied for the verification
and validation of end users, likewise, a registration number is provided by
the application procedures which keeps a track and record of data usage.
The local area office handles this thing.
2.NoSQL Database
These are used for large sets of distributed data. There are some big data
performance issues which are effectively handled by relational databases,
such kind of issues are easily managed by NoSQL databases. There are
very efficient in analyzing large size unstructured data that may be stored at
multiple virtual servers of the cloud.
Answer-
All modern database management systems like SQL, MS SQL Server, IBM
DB2, ORACLE, My-SQL and Microsoft Access are based on RDBMS.
1.1Tire architecture
2.2Tire architecture
3.3Tire architecture
Answer-
1. Internal Level
o The internal level has an internal schema which describes the
physical storage structure of the database.
o The internal schema is also known as a physical schema.
o It uses the physical data model. It is used to define that how the
data will be stored in a block.
o The physical level is used to describe complex low-level data
structures in detail.
2. Conceptual Level
o The conceptual schema describes the design of a database at the
conceptual level. Conceptual level is also known as logical level.
o The conceptual schema describes the structure of the whole
database.
o The conceptual level describes what data are to be stored in the
database and also describes what relationship exists among those
data.
o In the conceptual level, internal details such as an implementation
of the data structure are hidden.
o Programmers and database administrators work at this level.
3. External Level
o At the external level, a database contains several schemas that
sometimes called as subschema. The subschema is used to
describe the different view of the database.
o An external schema is also known as view schema.
o Each view schema describes the database part that a particular
user group is interested and hides the remaining database from
that user group.
o The view schema describes the end user interaction with database
systems.
Answer-
> Database language can be used to read,store and update the data in the
database.
DDL :
DDL is short name of Data Definition Language, which deals with database
schemas and descriptions, of how the data should reside in the database.
CREATE - to create a database and its objects like (table, index, views,
store procedure, function, and triggers)
ALTER - alters the structure of the existing database
DROP - delete objects from the database
TRUNCATE - remove all records from a table, including all spaces
allocated for the records are removed
COMMENT - add comments to the data dictionary
RENAME - rename an object
DML :
DML is short name of Data Manipulation Language which deals with data
manipulation and includes most common SQL statements such SELECT,
INSERT, UPDATE, DELETE, etc., and it is used to store, modify, retrieve,
delete and update data in a database.
DCL :
DCL is short name of Data Control Language which includes commands
such as GRANT and mostly concerned with rights, permissions and other
controls of the database system.
Answer-
ER model :
o ER model stands for an Entity-Relationship model. It is a high-level
data model. This model is used to define the data elements and
relationship for a specified system.
o It develops a conceptual design for the database. It also develops a
very simple and easy to design view of data.
o In ER modeling, the database structure is portrayed as a diagram
called an entity-relationship diagram.
Component of ER Diagram :
1. Entity:
2. Attribute :
3. Relationship :
Answer-
Candidate Key - The candidate keys in a table are defined as the set
of keys that is minimal and can uniquely identify any data row in the
table.
Primary Key - The primary key is selected from one of the candidate
keys and becomes the identifying key of a table. It can uniquely
identify any data row of the table.
Super Key - Super Key is the superset of primary key. The super key
contains a set of attributes, including the primary key, which can
uniquely identify any data row in the table.
Q8-What is normalizaation?
Answer-
The inventor of the relational model Edgar Codd proposed the theory of
normalization with the introduction of the First Normal Form, and he
continued to extend theory with Second and Third Normal Form. Later he
joined Raymond F. Boyce to develop the theory of Boyce-Codd Normal
Answer-
States through which a transaction goes during its lifetime. These are the
states which tell about the current state of the Transaction and also tell how
we will further do processing we will do on the transactions. These states
govern the rules which decide the fate of the transaction whether it will
commit or abort.
3. Failed State –
When any instruction of the transaction fails it goes to “failed state” or
if failure occurs in making permanent change of data on Data Base.
4. Aborted State –
After having any type of failure the transaction goes from “failed state”
to “aborted state” and in before states the changes are only made to
local buffer or main memory and hence these changes are deleted or
rollback.
5. Committed Stage –
It is the stage when the changes are made permanent on the Data
Base and transaction is complete and therefore terminated in
“terminated state”.
6. Terminated State –
If there is any roll back or the transaction come from “committed state”
then the system is consistent and ready for new transaction and the
old transaction is terminated.
Q10-Explain Queries.
a).Make Table-Employee
Answer-
+-----------------+--------------+------+-----+---------+-------
+
| Field | Type | Null | Key | Default | Extra
|
+-----------------+--------------+------+-----+---------+-------
+
| DEPARTMENT_ID | decimal(4,0) | NO | PRI | 0 |
|
| DEPARTMENT_NAME | varchar(30) | NO | | NULL |
|
| MANAGER_ID | decimal(6,0) | NO | PRI | 0 |
|
| LOCATION_ID | decimal(4,0) | YES | | NULL |
|
+-----------------+--------------+------+-----+---------+-------
+
Sample Solution:
CREATE TABLE IF NOT EXISTS employees (
EMPLOYEE_ID decimal(6,0) NOT NULL PRIMARY KEY,
FIRST_NAME varchar(20) DEFAULT NULL,
LAST_NAME varchar(25) NOT NULL,
EMAIL varchar(25) NOT NULL,
PHONE_NUMBER varchar(20) DEFAULT NULL,
HIRE_DATE date NOT NULL,
JOB_ID varchar(10) NOT NULL,
SALARY decimal(8,2) DEFAULT NULL,
COMMISSION_PCT decimal(2,2) DEFAULT NULL,
MANAGER_ID decimal(6,0) DEFAULT NULL,
DEPARTMENT_ID decimal(4,0) DEFAULT NULL,
FOREIGN KEY(DEPARTMENT_ID,MANAGER_ID)
REFERENCES departments(DEPARTMENT_ID,MANAGER_ID)
)ENGINE=InnoDB;