Basics Flashcards

1
Q

DataBase

A

The database is a collection of inter-related data which helps in efficient retrieval, insertion, and deletion of data from the database and organizes the data in the form of tables, views, schemas, reports, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

DDL

A

DDL is the short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

DDL commands

A

Data definition language
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

It helps in the creation, modification, and removal of definitions that define the organization of data in the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

DML

A

DML is the 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

DBMS

A

Database Management System: The software which is used to manage the database is called Database Management System (DBMS). For Example, MySQL, Oracle, etc. are popular commercial DBMS used in different applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why not File System?

A

Redundancy of data
Inconsistency of Data
Difficult Data Access
Unauthorized Access
No Concurrent Access( access of same data by multiple users at the same time is known as concurrency)
No Backup and Recovery

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Data Independence

A

Data independence means a change of data at one level should not affect another level.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Physical Data independence

A

Physical Data Independence: Any change in the physical location of tables and indexes should not affect the conceptual level or external view of data. This data independence is easy to achieve and implemented by most of the DBMS.

The physical level of a database describes how the data is being stored in secondary storage devices like disks and tapes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Conceptual data independence

A

Conceptual Data Independence: The data at conceptual level schema and external level schema must be independent.
This means a change in conceptual schema should not affect external schema.
e.g.; Adding or deleting attributes of a table should not affect the user’s view of the table. But this type of independence is difficult to achieve as compared to physical data independence because the changes in conceptual schema are reflected in the user’s view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Entity and Entity set

A

An Entity is an object of Entity Type and a set of all entities is called an entity set. e.g.; E1 is an entity having Entity Type Student and the set of all students is called Entity Set.
Attributes are the properties that define the entity type. For example, Roll_No, Name, DOB, Age, Address, Mobile_No are the attributes that define entity type Student.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Composite Attribute

A

An attribute composed of many other attributes is called a composite attribute. For example, the Address attribute of student Entity type consists of Street, City, State, and Country.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Relationship between entities

A

A relationship type represents the association between entity types. For example, ‘Enrolled in’ is a relationship type that exists between entity type Student and Course.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Cardinality

A

The number of times an entity of an entity set participates in a relationship set is known as cardinality.
types:
One to one
many to one
many to many

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Participation Constraint:

A

Total Participation – Each entity in the entity set must participate in the relationship. If each student must enroll in a course, the participation of the student will be total.
Partial Participation – The entity in the entity set may or may NOT participate in the relationship. If some courses are not enrolled by any of the students, the participation of the course will be partial.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Weak Entity

A

an entity type has a key attribute that uniquely identifies each entity in the entity set. But there exists some entity type for which key attributes can’t be defined. These are called the Weak Entity types

For example, A company may store the information of dependants of an Employee. But the dependents don’t have existed without the employee. So Dependent will be weak entity type and Employee will be Identifying Entity type for Dependant.

The participation of the weak entity type is always total.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Participation of weak entity is ——

A

Total

17
Q

ER diagram

A

Entity-Relationship (ER) Diagram is a diagrammatic representation of data in databases, it shows how data is related.

18
Q

Generalization

A

Generalization is the process of extracting common properties from a set of entities and create a generalized entity from it.

It is a bottom-up approach in which two or more entities can be generalized to a higher-level entity if they have some attributes in common.

19
Q

Specialization

A

In specialization, an entity is divided into sub-entities based on its characteristics.
It is a top-down approach where the higher-level entity is specialized into two or more lower-level entities.

20
Q

The relational model represents data in the form of ____

A

Relations or Tables

21
Q

Relational Instance:

A

The set of values present in a relationship at a particular instance of time is known as relational instance

22
Q

In a row of a relational table, how many values can an attribute have?

A

In a row of a relational table, an attribute can have exactly one value or a NULL value

23
Q

Relational model

A

The relational model was proposed by E.F. Codd to model data in the form of relations or tables.

24
Q

Relation schema

A

STUDENT (ROLL_NO, NAME, ADDRESS, PHONE, and AGE) is relation schema for STUDENT.
A relation schema represents the name of the relation with its attributes.

25
Q

Degree of relation

A

The number of attributes in the relation is known as the degree of the relation.

26
Q

Constraints in Relational Model

A

While designing the Relational Model, we define some conditions which must hold for data present in the database are called Constraints. These constraints are checked before performing any operation (insertion, deletion, and updation) in the database. If there is a violation of any of the constraints, the operation will fail.

27
Q

Types of constraints

A

Domain Constraints
Key Integrity:It should be unique for all tuples and cannot be NULL
Referential Integrity:

28
Q

Anomalies in referencing relation

A

Insertion Anomaly in Referencing Relation:
We can’t insert a row in REFERENCING RELATION if referencing attribute’s value is not present in the referenced attribute value.
Deletion/ Updation Anomaly in Referenced Relation: We can’t delete or update a row from REFERENCED RELATION if the value of REFERENCED ATTRIBUTE is used in the value of REFERENCING ATTRIBUTE.

29
Q

Keys

A

Any set of attributes that allows us to identify unique rows (tuples) in a given relationship are known as super keys.
Out of these super keys, we can always choose a proper subset among these which can be used as a primary key. Such keys are known as Candidate keys. I
f there is a combination of two or more attributes that is being used as the primary key then we call it a Composite key.

30
Q

Difference between super key and primary key

A

The super key is different from the primary and candidate keys in the sense that only the minimal superkeys are the candidate/primary keys.

31
Q

Why data normalization?

A

To reduce data redundancy

32
Q

First Normal Form

A

a relation is in first normal form if it does not contain any composite or multi-valued attribute.

33
Q

Second normal form

A

A relation is in 2NF if it has No Partial Dependency, i.e., no non-prime attribute (attributes which are not part of any candidate key) is dependent on any proper subset of any candidate key of the table.

Partial Dependency – If the proper subset of candidate keys determines non-prime attributes, it is called partial dependency.

34
Q

Third normal form

A

A relation is in the third normal form if there is no transitive dependency for non-prime attributes as well as it is in the second normal form.

A relation is in 3NF if at least one of the following conditions holds in every non-trivial function dependency X –> Y
X is a super key.
Y is a prime attribute (each element of Y is part of some candidate key).

35
Q

BCNF

A

A relation is in BCNF iff in every non-trivial functional dependency X –> Y, X is a super key.

36
Q

DCL

A

Data Control Language which acts as an access specifier to the database.(basically to grant and revoke permissions to users in the database

37
Q

ER models which view

A

ER Model is used to model the logical view of the system from data perspective which consists of these components:

Entity, Entity Type, Entity Set