0% found this document useful (0 votes)
4 views

Ddbmss

A database is a structured collection of inter-related data managed by a Database Management System (DBMS) which allows for efficient data operations. DBMS provides advantages like reduced redundancy, data sharing, and easy maintenance, but also has disadvantages such as high costs and complexity. Various data models exist to understand database structures, and SQL is the standard language used for managing relational databases, featuring commands for data manipulation and defining data structures.

Uploaded by

aesrdt119b
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Ddbmss

A database is a structured collection of inter-related data managed by a Database Management System (DBMS) which allows for efficient data operations. DBMS provides advantages like reduced redundancy, data sharing, and easy maintenance, but also has disadvantages such as high costs and complexity. Various data models exist to understand database structures, and SQL is the standard language used for managing relational databases, featuring commands for data manipulation and defining data structures.

Uploaded by

aesrdt119b
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

What is Database

The database is a collection of inter-related data which is used to retrieve, insert and delete
the data efficiently. It is also used to organize the data in the form of a table, schema,
views, and reports, etc.

Database Management System

Database management system is a software which is used to manage the database. For
example: MySQL, Oracle, etc are a very popular commercial database which is used in
different applications.

DBMS provides an interface to perform various operations like database creation, storing
data in it, updating data, creating a table in the database and a lot more.

It provides protection and security to the database. In the case of multiple users, it also
maintains data consistency

Advantages of DBMS

Controls database redundancy: It can control data redundancy because it stores all the data
in one single database file and that recorded data is placed in the database.

Data sharing: In DBMS, the authorized users of an organization can share the data among
multiple users.

Easily Maintenance: It can be easily maintainable due to the centralized nature of the
database system.

Reduce time: It reduces development time and maintenance need.

Backup: It provides backup and recovery subsystems which create automatic backup of
data from hardware and software failures and restores the data if required.

multiple user interface: It provides different types of user interfaces like graphical user
interfaces, application program interfaces

Disadvantages of DBMS

Cost of Hardware and Software: It requires a high speed of data processor and large
memory size to run DBMS software.

Size: It occupies a large space of disks and large memory to run them efficiently.

Complexity: Database system creates additional complexity and requirements.


Higher impact of failure: Failure is highly impacted the database because in most of the
organization, all the data stored in a single database and if the database is damaged due to
electric failure or database corruption then the data may be lost forever.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Data Models

Data Model is the modeling of the data description, data semantics, and consistency
constraints of the data. It provides the conceptual tools for describing the design of a
database at each level of data abstraction. Therefore, there are following four data models
used for understanding the structure of the database:

1) Relational Data Model: This type of model designs the data in the form of rows and
columns within a table. Thus, a relational model uses tables for representing data and in-
between relationships. Tables are also called relations. This model was initially described by
Edgar F. Codd, in 1969. The relational data model is the widely used model which is
primarily used by commercial data processing applications.

2) Entity-Relationship Data Model: An ER model is the logical representation of data as


objects and relationships among them. These objects are known as entities, and
relationship is an association among these entities. This model was designed by Peter Chen
and published in 1976 papers. It was widely used in database designing. A set of attributes
describe the entities. For example, student_name, student_id describes the 'student' entity.
A set of the same type of entities is known as an 'Entity set', and the set of the same type of
relationships is known as 'relationship set'.

3) Object-based Data Model: An extension of the ER model with notions of functions,


encapsulation, and object identity, as well. This model supports a rich type system that
includes structured and collection types. Thus, in 1980s, various database systems following
the object-oriented approach were developed. Here, the objects are nothing but the data
carrying its properties.

4) Semistructured Data Model: This type of data model is different from the other three
data models (explained above). The semistructured data model allows the data
specifications at places where the individual data items of the same type may have
different attributes sets. The Extensible Markup Language, also known as XML, is widely
used for representing the semistructured data. Although XML was initially designed for
including the markup information to the text document, it gains importance because of its
application in the exchange of data

>>>>>>>>>>>>>>>>>>>>>>>>>>>
sql? data type in sql?

SQL stands for Structured Query Language. It is used for storing and managing data in
relational database management system (RDMS).

It is a standard language for Relational Database System. It enables a user to create, read,
update and delete relational databases and tables.

All the RDBMS like MySQL, Informix, Oracle, MS Access and SQL Server use SQL as their
standard database language.

SQL allows users to query the database in a number of ways, using English-like statements.

SQL process:

When an SQL command is executing for any RDBMS, then the system figure out the best
way to carry out the request and the SQL engine determines that how to interpret the task.

In the process, various components are included. These components can be optimization
Engine, Query engine, Query dispatcher, classic, etc.

All the non-SQL queries are handled by the classic query engine, but SQL query engine
won't handle logical files.

Datatype of SQL

1. Binary Datatypes

binary >>It has a maximum length of 8000 bytes. It contains fixed-length binary data.

varbinary>> It has a maximum length of 8000 bytes. It contains variable-length binary data.

image >>It has a maximum length of 2,147,483,647 bytes. It contains variable-length binary
data.

2. Approximate Numeric Datatype :

The subtypes are given below:

Data type From To Description

float -1.79E + 308 1.79E + 308 It is used to specify a floating-point value e.g. 6.2, 2.9 etc.

real -3.40e + 38 3.40E + 38 It specifies a single precision floating point number

2. Approximate Numeric Datatype :

The subtypes are given below:


3. Exact Numeric Datatype

The subtypes are given below:

Data type Description

int It is used to specify an integer value.

smallint It is used to specify small integer value.

bit It has the number of bits to store.

decimal It specifies a numeric value that can have a decimal number.

numeric It is used to specify a numeric value.

4. Character String Datatype

The subtypes are given below:

char It has a maximum length of 8000 characters. It contains Fixed-length non-unicode


characters.

varchar It has a maximum length of 8000 characters. It contains variable-length non-


unicode characters.

text It has a maximum length of 2,147,483,647 characters. It contains variable-length non-


unicode characters.

5. Date and time Datatypes

date It is used to store the year, month, and days value.

time It is used to store the hour, minute, and second values.

timestamp It stores the year, month, day, hour, minute, and the second value.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

operators in dbms???

Arithmetic Operators:

+ (Addition): Adds two values.

- (Subtraction): Subtracts the right operand from the left operand.

* (Multiplication): Multiplies two values.

/ (Division): Divides the left operand by the right operand.


% (Modulus): Returns the remainder of the division of the left operand by the right
operand.

sql

Copy code

SELECT salary * 1.1 AS increased_salary

FROM employees;

Comparison Operators:

= (Equal to): Checks if two values are equal.

<> or != (Not equal to): Checks if two values are not equal.

< (Less than): Checks if the left operand is less than the right operand.

> (Greater than): Checks if the left operand is greater than the right operand.

<= (Less than or equal to): Checks if the left operand is less than or equal to the right
operand.

>= (Greater than or equal to): Checks if the left operand is greater than or equal to the right
operand.

sql

Copy code

SELECT product_name

FROM products

WHERE price > 100;

Logical Operators:

AND: Returns true if both conditions are true.

OR: Returns true if at least one of the conditions is true.

NOT: Returns true if the following condition is false.

sql

Copy code

SELECT product_name
FROM products

WHERE category = 'Electronics' AND price > 500;

Concatenation Operator:

|| (Double Pipe): Concatenates two strings.

sql

Copy code

SELECT first_name || ' ' || last_name AS full_name

FROM employees;

IN Operator:

Checks if a specified value matches any value in a list.

sql

Copy code

SELECT product_name

FROM products

WHERE category IN ('Electronics', 'Appliances');

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

dml

DML is an abbreviation of Data Manipulation Language.

The DML commands in Structured Query Language change the data present in the SQL
database. We can easily access, store, modify, update and delete the existing records from
the database using DML commands.

Following are the four main DML commands in SQL:

SELECT Command

INSERT Command

UPDATE Command

DELETE Command

SELECT DML Command


SELECT is the most important data manipulation command in Structured Query Language.
The SELECT command shows the records of the specified table. It also shows the particular
record of a particular column by using the WHERE clause3

Syntax of SELECT DML command

SELECT column_Name_1, column_Name_2, ….., column_Name_N FROM Name_of_table;

INSERT DML Command

INSERT is another most important data manipulation command in Structured Query


Language, which allows users to insert data in database tables.

Syntax of INSERT Command

INSERT INTO TABLE_NAME ( column_Name1 , column_Name2 , column_Name3 , ....


column_NameN ) VALUES (value_1, value_2, value_3, .... value_N ) ;

UPDATE DML Command

UPDATE is another most important data manipulation command in Structured Query


Language, which allows users to update or modify the existing data in database tables.

Syntax of UPDATE Command

UPDATE Table_name SET [column_name1= value_1, ….., column_nameN = value_N]


WHERE CONDITION;

DELETE DML Command

DELETE is a DML command which allows SQL users to remove single or multiple existing
records from the database tables.

This command of Data Manipulation Language does not delete the stored data
permanently from the database. We use the WHERE clause with the DELETE command to
select specific rows from the table.

Syntax of DELETE Command

DELETE FROM Table_Name WHERE condition;

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

acid proprties??

DBMS is the management of data that should remain integrated when any changes are
done in it. It is because if the integrity of the data is affected, whole data will get disturbed
and corrupted. Therefore, to maintain the integrity of the data, there are four properties
described in the database management system, which are known as the ACID properties.
The ACID properties are meant for the transaction that goes through a different group of
tasks, and there we come to see the role of the ACID properties.

The expansion of the term ACID defines for:

1) Atomicity

2) Consistency

3) Isolation

4) Durability

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

define ddl?

Data Definition Language (DDL)

DDL changes the structure of the table like creating a table, deleting a table, altering a
table, etc.

All the command of DDL are auto-committed that means it permanently save all the
changes in the database.

Here are some commands that come under DDL:

CREATE

ALTER

DROP

TRUNCATE

a. CREATE It is used to create a new table in the database.

CREATE TABLE EMPLOYEE(Name VARCHAR2(20), Email VARCHAR2(100), DOB DATE);

b. DROP: It is used to delete both the structure and record stored in the table.

DROP TABLE EMPLOYEE;

c. ALTER: It is used to alter the structure of the database. This change could be either to
modify the characteristics of an existing attribute or probably to add a new attribute.

ALTER TABLE STU_DETAILS ADD(ADDRESS VARCHAR2(20));

ALTER TABLE STU_DETAILS MODIFY (NAME VARCHAR2(20));


d. TRUNCATE: It is used to delete all the rows from the table and free the space containing
the table.

TRUNCATE TABLE EMPLOYEE;

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

explain concurrency control??

Concurrency Control

Concurrency Control is the working concept that is required for controlling and managing
the concurrent execution of database operations and thus avoiding the inconsistencies in
the database. Thus, for maintaining the concurrency of the database, we have the
concurrency control protocols.

Concurrency Control Protocols

The concurrency control protocols ensure the atomicity, consistency, isolation, durability
and serializability of the concurrent execution of the database transactions. Therefore,
these protocols are categorized as:

Lock Based Concurrency Control Protocol

Time Stamp Concurrency Control Protocol

Validation Based Concurrency Control Protocol

>>>>>>>>>>>>>>>>>>>>>>

what is trigger?

A Trigger in Structured Query Language is a set of procedural statements which are


executed automatically when there is any response to certain events on the particular table
in the database. Triggers are used to protect the data integrity in the database.

Types of Triggers in SQL

Following are the six types of triggers in SQL:

AFTER INSERT Trigger

This trigger is invoked after the insertion of data in the table.

AFTER UPDATE Trigger

This trigger is invoked in SQL after the modification of the data in the table.

AFTER DELETE Trigger


This trigger is invoked after deleting the data from the table.

BEFORE INSERT Trigger

This trigger is invoked before the inserting the record in the table.

BEFORE UPDATE Trigger

This trigger is invoked before the updating the record in the table.

BEFORE DELETE Trigger

This trigger is invoked before deleting the record from the table.

>>>>>>>>>>>>>

What is Data abstraction in Database Management System?

The database system contains intricate data structures and relations. The developers keep
away the complex data from the user and remove the complications so that the user can
comfortably access data in the database and can only access the data they want, which is
done with the help of data abstraction.

The main purpose of data abstraction is to hide irrelevant data and provide an abstract
view of the data. With the help of data abstraction, developers hide irrelevant data from
the user and provide them the relevant data. By doing this, users can access the data
without any hassle, and the system will also work efficiently.

Advantages of data abstraction in DBMS.

Users can easily access the data based on their queries.

It provides security to the data stored in the database.

Database systems work efficiently because of data abstraction.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

what is three schema architecture?

The three schema architecture is also called ANSI/SPARC architecture or three-level


architecture.

This framework is used to describe the structure of a specific database system.

The three schema architecture is also used to separate the user applications and physical
database.
The three schema architecture contains three-levels. It breaks the database down into
three different categories.

Objectives of Three schema Architecture

The main objective of three level architecture is to enable multiple users to access the same
data with a personalized view while storing the underlying data only once. Thus it separates
the user's view from the physical structure of the database. This separation is desirable for
the following reasons:

Different users need different views of the same data.

The approach in which a particular user needs to see the data may change over time.

The users of the database should not worry about the physical implementation and internal
workings of the database such as data compression and encryption techniques, hashing,
optimization of the internal structures etc.

All users should be able to access the same data according to their requirements.

DBA should be able to change the conceptual structure of the database without affecting
the user's

Internal structure of the database should be unaffected by changes to physical aspects of


the storage.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

transaction? and their propeties?

The transaction is a set of logically related operation. It contains a group of tasks.

A transaction is an action or series of actions. It is performed by a single user to perform


operations for accessing the contents of the database.

The transaction has the four properties. These are used to maintain consistency in a
database, before and after the transaction.

Property of Transaction

Atomicity

Consistency

Isolation

Durability
Atomicity

It states that all operations of the transaction take place at once if not, the transaction is
aborted.

There is no midway, i.e., the transaction cannot occur partially. Each transaction is treated
as one unit and either run to completion or is not executed at all.

Consistency

The integrity constraints are maintained so that the database is consistent before and after
the transaction.

The execution of a transaction will leave a database in either its prior stable state or a new
stable state.

The consistent property of database states that every transaction sees a consistent
database instance.

The transaction is used to transform the database from one consistent state to another
consistent state.

Isolation

It shows that the data which is used at the time of execution of a transaction cannot be
used by the second transaction until the first one is completed.

In isolation, if the transaction T1 is being executed and using the data item X, then that data
item can't be accessed by any other transaction T2 until the transaction T1 ends.

The concurrency control subsystem of the DBMS enforced the isolation property.

Durability

The durability property is used to indicate the performance of the database's consistent
state. It states that the transaction made the permanent changes.

They cannot be lost by the erroneous operation of a faulty transaction or by the system
failure. When a transaction is completed, then the database reaches a state known as the
consistent state. That consistent state cannot be lost, even in the event of a system's
failure.

The recovery subsystem of the DBMS has the responsibility of Durability property.

>>>>>>>>>>>>>

What is Normalization?
Normalization is the process of organizing the data in the database.

Normalization is used to minimize the redundancy from a relation or set of relations. It is


also used to eliminate undesirable characteristics like Insertion, Update, and Deletion
Anomalies.

Normalization divides the larger table into smaller and links them using relationships.

The normal form is used to reduce redundancy from the database table.

Why do we need Normalization?

The main reason for normalizing the relations is removing these anomalies. Failure to
eliminate anomalies leads to data redundancy and can cause data integrity and other
problems as the database grows. Normalization consists of a series of guidelines that helps
to guide you in creating a good database structure.

Advantages of Normalization

Normalization helps to minimize data redundancy.

Greater overall database organization.

Data consistency within the database.

Much more flexible database design.

Enforces the concept of relational integrity.

types of normalization>

1NF A relation is in 1NF if it contains an atomic value.

2NF A relation will be in 2NF if it is in 1NF and all non-key attributes are fully functional
dependent on the primary key.

3NF A relation will be in 3NF if it is in 2NF and no transition dependency exists.

BCNF A stronger definition of 3NF is known as Boyce Codd's normal form.

4NF A relation will be in 4NF if it is in Boyce Codd's normal form and has no multi-valued
dependency.

5NF A relation is in 5NF. If it is in 4NF and does not contain any join dependency, joining
should be lossless.

>>>>>>>>>>>>>>>>>>>

Difference between DBMS and rdbms


DBMS

1>>DBMS applications store data as file.

2>>In DBMS, data is generally stored in either a hierarchical form or a navigational form

3>>Normalization is not present in DBMS.

4>>DBMS does not apply any security with regards to data manipulation.

5>>DBMS uses file system to store data, so there will be no relation between the tables

6>>DBMS has to provide some uniform methods to access the stored information.

7>>DBMS does not support distributed database.

8>>DBMS is meant to be for small organization and deal with small data. it supports single
user.

9>>Examples of DBMS are file systems, xml etc.

RDBMS

1>>RDBMS applications store data in a tabular form.

2>>In RDBMS, the tables have an identifier called primary key and the data values are
stored in the form of tables.

3>>Normalization is present in RDBMS.

4>>RDBMS defines the integrity constraint for the purpose of ACID (Atomocity,
Consistency, Isolation and Durability) property.

5>>in RDBMS, data values are stored in the form of tables, so a relationship between these
data values will be stored in the form of a table as well.

6>>RDBMS system supports a tabular structure of the data and a relationship between
them to access the stored information.

7>>RDBMS supports distributed database.

8>>RDBMS is designed to handle large amount of data. it supports multiple users.

9>>Example of RDBMS are mysql, postgre, sql server, oracle etc.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

define 3nf?

A relation will be in 3NF if it is in 2NF and not contain any transitive partial dependency.
3NF is used to reduce the data duplication. It is also used to achieve the data integrity.

If there is no transitive dependency for non-prime attributes, then the relation must be in
third normal form.

define bcnf?

BCNF is the advance version of 3NF. It is stricter than 3NF.

A table is in BCNF if every functional dependency X ? Y, X is the super key of the table.

For BCNF, the table should be in 3NF, and for every FD, LHS is super key.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

what is entity and types?

Entities are stored in the database, and they should be distinguishable, i.e., they should be
easily identifiable from the group. For example, a group of pens that are from the same
company cannot be identified, so they are only objects, but pens with different colours
become unique and will be called an entity like a red pen, green pen, blue pen, black pen,
etc.

Kinds of Entity:

There are two kinds of entities, which are as follows:

1. Tangible Entity:It is an entity in DBMS, which is a physical object that we can touch or
see. In simple words, an entity that has a physical existence in the real world is called a
tangible entity.

2. Intangible Entity:

It is an entity in DBMS, which is a non-physical object that we cannot see or touch. In simple
words, an entity that does not have any physical existence in the real world is known as an
intangible entity.

Kinds of Entity Type

1. Strong Entity Type: It is an entity that has its own existence and is independent.

The entity relationship diagram represents a strong entity type with the help of a single
rectangle

2. Weak Entity Type: It is an entity that does not have its own existence and relies on a
strong entity for its existence.

The Entity Relationship Diagram represents the weak entity type using double rectangles
>>>>>>>>>>>>>>>>>>>

Types of different types of datbase user?

Database Administrator (DBA) : Database Administrator (DBA) is a person/team who


defines the schema and also controls the 3 levels of database. The DBA will then create a
new account id and password for the user if he/she need to access the database. DBA is
also responsible for providing security to the database and he allows only the authorized
users to access/modify the data base. DBA is responsible for the problems such as security
breaches and poor system response time.

DBA also monitors the recovery and backup and provide technical support.

The DBA has a DBA account in the DBMS which called a system or superuser account.

DBA repairs damage caused due to hardware and/or software failures.

DBA is the one having privileges to perform DCL (Data Control Language) operations such as
GRANT and REVOKE, to allow/restrict a particular user from accessing the database.

Naive / Parametric End Users : Parametric End Users are the unsophisticated who don’t
have any DBMS knowledge but they frequently use the database applications in their daily
life to get the desired results. For examples, Railway’s ticket booking users are naive users.
Clerks in any bank is a naive user because they don’t have any DBMS knowledge but they
still use the database and perform their given task.

System Analyst :

System Analyst is a user who analyzes the requirements of parametric end users. They
check whether all the requirements of end users are satisfied.

Sophisticated Users : Sophisticated users can be engineers, scientists, business analyst, who
are familiar with the database. They can develop their own database applications according
to their requirement. They don’t write the program code but they interact the database by
writing SQL queries directly through the query processor.

Database Designers : Data Base Designers are the users who design the structure of
database which includes tables, indexes, views, triggers, stored procedures and constraints
which are usually enforced before the database is created or populated with data. He/she
controls what data must be stored and how the data items to be related. It is responsibility
of Database Designers to understand the requirements of different user groups and then
create a design which satisfies the need of all the user groups.

Application Programmers : Application Programmers also referred as System Analysts or


simply Software Engineers, are the back-end programmers who writes the code for the
application programs. They are the computer professionals. These programs could be
written in Programming languages such as Visual Basic, Developer, C, FORTRAN, COBOL etc.
Application programmers design, debug, test, and maintain set of programs called “canned
transactions” for the Naive (parametric) users in order to interact with database.

Casual Users / Temporary Users : Casual Users are the users who occasionally use/access
the database but each time when they access the database they require the new
information, for example, Middle or higher level manager.

Specialized users : Specialized users are sophisticated users who write

specialized database application that does not fit into the traditional data-

processing framework. Among these applications are computer aided-design

systems, knowledge-base and expert systems etc.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Types of Relational operation

1. Select Operation:The select operation selects tuples that satisfy a given predicate.

It is denoted by sigma (s).

2. Project Operation:

This operation shows the list of those attributes that we wish to appear in the result. Rest
of the attributes are eliminated from the table.

It is denoted by ?.

3. Union Operation:

Suppose there are two tuples R and S. The union operation contains all the tuples that are
either in R or S or both in R & S.

It eliminates the duplicate tuples. It is denoted by ?.

4. Set Intersection:

Suppose there are two tuples R and S. The set intersection operation contains all tuples
that are in both R & S.

It is denoted by intersection n.

5. Set Difference:
Suppose there are two tuples R and S. The set intersection operation contains all tuples
that are in R but not in S.

It is denoted by intersection minus (-).

6. Cartesian product

The Cartesian product is used to combine each row in one table with each row in the other
table. It is also known as a cross product.

It is denoted by X.

7. Rename Operation:

The rename operation is used to rename the output relation. It is denoted by rho (?).

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

dynamic sql?

Dynamic SQL is a programming technique that could be used to write SQL queries during
runtime. Dynamic SQL could be used to create general and flexible SQL queries.

Syntax for dynamic SQL is to make it string as below :

'SELECT statement';

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Types of keys:

1. Primary key

It is the first key used to identify one and only one instance of an entity uniquely. An entity
can contain multiple keys, as we saw in the PERSON table. The key which is most suitable
from those lists becomes a primary key.

2. Candidate key

A candidate key is an attribute or set of attributes that can uniquely identify a tuple.

Except for the primary key, the remaining attributes are considered a candidate key. The
candidate keys are as strong as the primary key.

3. Super Key

Super key is an attribute set that can uniquely identify a tuple. A super key is a superset of a
candidate key.
4. Foreign key

Foreign keys are the column of the table used to point to the primary key of another table.

Every employee works in a specific department in a company, and employee and


department are two different entities. So we can't store the department's information in
the employee table. That's why we link these two tables through the primary key of one
table.

5. Alternate key

There may be one or more attributes or a combination of attributes that uniquely identify
each tuple in a relation. These attributes or combinations of the attributes are called the
candidate keys. One key is chosen as the primary key from these candidate keys, and the
remaining candidate key, if it exists, is termed the alternate key. In other words, the total
number of the alternate keys is the total number of candidate keys minus the primary key.
The alternate key may or may not exist. If there is only one candidate key in a relation, it
does not have an alternate key.

6. Composite key

Whenever a primary key consists of more than one attribute, it is known as a composite
key. This key is also known as Concatenated Key.

7. Artificial key

The key created using arbitrarily assigned data are known as artificial keys. These keys are
created when a primary key is large and complex and has no relationship with many other
relations. The data values of the artificial keys are usually numbered in a serial order.

>>>>>>>>>>>>>>>>>>>>>>>

Difference type of language in dbms??

1. Data Definition Language (DDL)

DDL stands for Data Definition Language. It is used to define database structure or pattern.

It is used to create schema, tables, indexes, constraints, etc. in the database.

Using the DDL statements, you can create the skeleton of the database.

. Data Manipulation Language (DML)

DML stands for Data Manipulation Language. It is used for accessing and manipulating data
in a database. It handles user requests.
Types of Database Languages

Select: It is used to retrieve data from a database.

Insert: It is used to insert data into a table.

Update: It is used to update existing data within a table.

Delete: It is used to delete all records from a table.

Merge: It performs UPSERT operation, i.e., insert or update operations.

Call: It is used to call a structured query language or a Java subprogram.

Explain Plan: It has the parameter of explaining data.

Lock Table: It controls concurrency.'

3. Data Control Language (DCL)

DCL stands for Data Control Language. It is used to retrieve the stored or saved data.

The DCL execution is transactional. It also has rollback parameters.

(But in Oracle database, the execution of data control language does not have the feature
of rolling back.)

Grant: It is used to give user access privileges to a database.

Revoke: It is used to take back permissions from the user.

4. Transaction Control Language (TCL)

TCL is used to run the changes made by the DML statement. TCL can be grouped into a
logical transaction.

Here are some tasks that come under TCL:

Commit: It is used to save the transaction on the database.

Rollback: It is used to restore the database to original since the last Commit.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Cardinality

Cardinality means how the entities are arranged to each other or what is the relationship
structure between entities in a relationship set. In a Database Management System,
Cardinality represents a number that denotes how many times an entity is participating
with another entity in a relationship set. The Cardinality of DBMS is a very important
attribute in representing the structure of a Database. In a table, the number of rows or
tuples represents the Cardinality.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

er model??

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.

It develops a conceptual design for the database. It also develops a very simple and easy to
design view of data.

In ER modeling, the database structure is portrayed as a diagram called an entity-


relationship diagram.

You might also like